Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Switch Control
Re: Switch Control [message #25021 is a reply to message #25020] Sun, 07 February 2010 18:49 Go to previous messageGo to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

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 Wink 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 Smile

Bye,Honza
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Pretty GUIs
Next Topic: document icon, how to?
Goto Forum:
  


Current Time: Thu May 09 22:57:00 CEST 2024

Total time taken to generate the page: 0.02168 seconds