I have an option menu which I want to be selected always with the first item. I made this on the stack with startup.
Code: Select all
on startup
set the menuLines of button "optionMenu" to 1
end startup
Maybe you have a solution
Thanks
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Code: Select all
on startup
set the menuLines of button "optionMenu" to 1
end startup
Code: Select all
on preopenstack
## This way always the first line (menuitem) will be displayed in the option button when the stack opens
set the label of btn "optionmenu" to line 1 of the text of btn "optionButton"
end preopenstack
What Klaus means is that even though LiveCode is a very conversational language, it still has a defined vocabulary. You are on the right track with your thinking, you just need to make sure that the words you use are actually part of the language.Please look up unknown*** terms like startup and menulines in the dictionary.
CAVEAT:
True, but only if you have a "menuPick" handler in play. The OP wanted this selection to occur automatically, so I assumed selecting the menuItem was also intended to invoke it. This may not be true. So, fhs14647, did you only want the label to show, or the label to show and the button to operate?Setting "the menuhistory" of a button is just like selecting the menuitem with the mouse
I don't see your point. What does making sense have to do with it?Sure, but a menubutton without functionality does not make much sense.
But there are other ways to script a menu button. You can also use mouseUp, circumventing the menuPick handler altogether.
Code: Select all
on preopenstack
set the label of btn "optionMenu" to line 1 of the text of btn "optionMenu"
put "+" into field "labelKind"
end preopenstack