Home » Community » Newbie corner » Switch Control
Re: Switch Control [message #25021 is a reply to message #25020] |
Sun, 07 February 2010 18:49 |
|
gedumer wrote on Sun, 07 February 2010 18:00 | There are no examples of the Switch Control (AKA. RadioButtons) in any of the examples nor in the tutorial so could someone who has used this control please help me? I have two Switch controls that I placed on my form using the Form Designer but I don't know how to use them.
|
Hi!
Simple reference program:#include <CtrlLib/CtrlLib.h>
using namespace Upp;
class guitest : public TopWindow {
public:
typedef guitest CLASSNAME;
Switch s;
void change(){
PromptOK(DeQtf("Switched to value "+AsString(~s))); //"~s" is shorthand for s.GetData()
}
guitest(){
Add(s); s.SizePos(); //in your case, this is already done in layout
s.Add("Case 1").Add(12,"Case 2").Add(13.5,"Case 3"); //chaining is possible ...
s.Add("Something","Another case").DisableValue(12); // ... but not mandatory
s<<=12; //shorthand for s.SetData(12);
s<<=THISBACK(change); // shorthand for s.WhenAction=THISBACK(change);
// note the interesting overloading ;)
}
};
GUI_APP_MAIN{
guitest().Run();
} Hope this helps Also look at the commented overloaded operators - they are what makes the development rapid in U++. And one of the reasons why I love this framework
Bye,Honza
|
|
|
Goto Forum:
Current Time: Thu May 09 22:57:00 CEST 2024
Total time taken to generate the page: 0.02168 seconds
|