Page 1 of 1
how to set default item in combobox
Posted: Tue Aug 04, 2015 7:38 am
by shalu
Hi,
I am beginner in live code, I am looking for the code of set the default item in combobox , eg: select, item1, item2, item3, if I select item 2 or 3 after performing it's task the it's automatically set to "select" option, is it possible
--
Thanks,
Shalu S
Re: how to set default item in combobox
Posted: Tue Aug 04, 2015 12:01 pm
by Klaus
Namaste Shalu,
not sure I understand, but maybe you just want to:
...
set the LABEL of btn "your combobox here" to "What the user will read in the button"
...
?
The label is just a string, so you can set it to whatever you want to.
Best
Klaus
Re: how to set default item in combobox
Posted: Tue Aug 04, 2015 2:13 pm
by dunbarx
Hi.
I like to use the "menuHistory" property, since it gives me the line number of the option menu. So if you have:
item 1
item 2
item 3
item 4
in the menu, and you:
Code: Select all
set the menuHistory of btn "yourOption" to 3
the third line will appear. This will, as Klaus points out, also set the label property to "item 3".
Craig Newman
Re: how to set default item in combobox
Posted: Tue Aug 04, 2015 2:39 pm
by Klaus
Hi friends,
remember that setting the menuhistory will also "fire" a MENUPICK with that menuitem!
Maybe this is unwanted here
Best
Klaus
Re: how to set default item in combobox
Posted: Tue Aug 04, 2015 7:46 pm
by dunbarx
True.
Setting the label of an option button does not change the menuHistory, nor fire the "menuPick" message.
One may set the menuHistory (in the earlier example) to, say, 1, which will show "item 1", and the label will also be "item 1". But if you then set the label to "item 3", the menuHistory does not change; it stays at 1. Perhaps this is a feature, that you can have the label follow the menuHistory, but not the other way around. Perhaps it is anomalous behavior.
Craig