Home » U++ Library support » U++ Widgets - General questions or Mixed problems » Help needed dealing with switch control
Help needed dealing with switch control [message #19879] |
Thu, 29 January 2009 16:58 |
kbyte
Messages: 87 Registered: July 2008
|
Member |
|
|
Hi,
I need to put two switch controls (option boxes) in to a form and they must be grouped in order to select one and the other one must be automatically unselected. I need also how to set the true value on them and get value they have.
Is there any switch tutorial? Cant find information on that.
Many thanks
Alex
|
|
|
|
Re: Help needed dealing with switch control [message #20017 is a reply to message #19879] |
Tue, 10 February 2009 10:23 |
kbyte
Messages: 87 Registered: July 2008
|
Member |
|
|
Sorry, but may be I didnt explain my problem:
I drawn a form in a lay file during design time. Please, see the jpeg attached.
During form initialization (run-time) I want to select the numerica switch button and clear (it is already) the alfanumerica switch button.
The second doublt is:
On visual basic and visual C we add (at design time) switch buttons and group them and they became mutual exclusive, this means when the user selects one all the others become unselected.
Does u++ has this automatic behaviour?
I am using this but it doesnt works:
void xxxdlg::OnSwitch1(void) //numerica
{
sw2<<NULL;
sw1<<1;
}
void xxxdlg::OnSwitch2(void) //alfanumerica
{
sw1<<NULL;
sw2<<1;
}
Many thanks
Alex
-
Attachment: option.JPG
(Size: 8.25KB, Downloaded 210 times)
[Updated on: Tue, 10 February 2009 10:29] Report message to a moderator
|
|
|
Re: Help needed dealing with switch control [message #20018 is a reply to message #20017] |
Tue, 10 February 2009 10:42 |
cbpporter
Messages: 1401 Registered: September 2007
|
Ultimate Contributor |
|
|
I'm not sure I understand your problem, but it could be caused by the way U++ handles Switches.
The traditional way of doing things is that if you want 3 switches, you will place 3 widgets on you form, each corresponding to a single option. Of course, you need to deactivate options when users interacts with on of the switches that constitute a logical group, and since witting such code would be repetitive for this very common scenario, you would place all tree switches in a GroupControl which will handle selecting items and logical grouping for you.
In U++ on the other hand, If you need to have 3 options, you will only add one single Switch to your layout. Then you will call Add 3 times on that Switch. In U++ Switch is actually more like a GroupControl, an calling Add populates it with "traditional switch" widgets. Switch is a group control, and is not like Option, which constitutes a single check box, not a group.
This works well for single groups, but if you need multiple groups that act as a single logical group, you will have to use something like mrjt suggested.
Switch should be able to handle both horizontal and vertical layout (as seen in your screenshot).
|
|
|
|
|
Goto Forum:
Current Time: Sat Apr 27 02:46:06 CEST 2024
Total time taken to generate the page: 0.04282 seconds
|