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 » U++ Library support » U++ Widgets - General questions or Mixed problems » Help needed dealing with switch control
Re: Help needed dealing with switch control [message #19942 is a reply to message #19879] Wed, 04 February 2009 10:11 Go to previous messageGo to previous message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
In case you still need help with this, I think this is the code you need:
CtrlLibTest::CtrlLibTest()
{
	CtrlLayout(*this, "Window title");

	switch1.Add(0, "One");
	switch1.Add(1, "Two");
	switch1.Add(2, "Three");
	switch1 <<= Null;

	switch2.Add(String("Letter A"), "A");
	switch2.Add(String("Letter B"), "B");
	switch2.Add(String("Letter C"), "C");
	switch2 <<= "Letter A";
	
	switch1 <<= THISBACK(OnSwitch1);
	switch2 <<= THISBACK(OnSwitch2);
}

void CtrlLibTest::OnSwitch1()
{
	switch2 <<= Null;
}

void CtrlLibTest::OnSwitch2()
{
	switch1 <<= Null;
}

If you were going to do this with more than two switches or quite often I'd create a SwitchGroup class that wasn't a Ctrl but handled the state of the switches for you.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: EditString validation
Next Topic: Win32 / Linux layouts
Goto Forum:
  


Current Time: Fri Nov 01 00:00:53 CET 2024

Total time taken to generate the page: 0.01617 seconds