Home » U++ Library support » U++ Widgets - General questions or Mixed problems » How to use droplist and switch
|
|
|
|
Re: How to use droplist and switch [message #10815 is a reply to message #10808] |
Tue, 31 July 2007 12:14   |
 |
fudadmin
Messages: 1321 Registered: November 2005 Location: Kaunas, Lithuania
|
Ultimate Contributor Administrator |
|
|
bonami wrote on Tue, 31 July 2007 03:47 |
i've got a switch in .lay, which can be assigned only one value. i try to add more in my main function with all methods as follows, but never achieved.
|
If I understand you correctly, you want to add more switch values with the layout designer. You can achieve that with "Set label" by adding more lines (preess Enter).
Alternatively, you can copy this layout (I suppose you know how to use Ctrl_T):
LAYOUT(SwitchButtonLay, 400, 200)
ITEM(Switch, swt_1, SetLabel(t_("&Opt1\nO&pt2")).LeftPosZ(28, 104).TopPosZ(12, 17))
END_LAYOUT
Then you can change vertical-horizontal layout simply by resizing with a mouse (changing ratio)
|
|
|
Re: How to use droplist and switch [message #10829 is a reply to message #10812] |
Wed, 01 August 2007 07:46   |
 |
bonami
Messages: 186 Registered: June 2007 Location: Beijing
|
Experienced Member |
|
|
mrjt wrote on Tue, 31 July 2007 17:19 |
comm_type.SetLabel("UDP\nTCP");
or
comm_type.Add("UDP").Add("TCP");
or
comm_type.Add(0, "UDP").Add(1, "TCP");
Will all work.
I would guess that you haven't made the Switch ctrl large enough in the Layout Designer (it does not resize automatically) and so you cannot see the other opptions.
James.
|
as i posted, i have used all these methods and none works for me. i tried again exactly using your Add... and failed. my layout is large enough to hold an elephant.
solution: put Add... in a function called after window class' constructor. i put Add... in topwindow's subclass' constructor then nothing works as i said and i cannot even stop there to debug. but if i put it elsewhere and call it after construction, it succeeds. this really puzzles me.
FUDAMIN, i've succeeded modifying .lay using TheIDE. this works.
thank you both anyway.
[Updated on: Wed, 01 August 2007 07:50] Report message to a moderator
|
|
|
|
|
|
Re: How to use droplist and switch [message #10897 is a reply to message #10881] |
Fri, 03 August 2007 04:19   |
 |
bonami
Messages: 186 Registered: June 2007 Location: Beijing
|
Experienced Member |
|
|
as i did afterwards, you changed .lay, too. this is the best way.
the key is the second problem you mentioned. i suppose the control is partialy initialized after the TopWindow so that you cannot set it in TopWindow's constructor.
as for the first one, i changed .lay, so i see the size is OK and did not change it back for the code to describe this question, i.e., it is not a problem.
further more, when i try to get selected value, if i directly call GetData(), it won't work, since .lay does not generate default values, even values as indexes or labels.
void ezcommwin::Butt_out()
{
...
comm_type.Set(0,0, "uu"); // this works
comm_type.Set(1,1); //this does not work
type = comm_type.GetData(); //only now can we get the value
after all, maybe it is a good idea not to use .lay for switches
[Updated on: Fri, 03 August 2007 11:48] Report message to a moderator
|
|
|
|
|
Goto Forum:
Current Time: Fri May 09 11:26:13 CEST 2025
Total time taken to generate the page: 0.00868 seconds
|