problem with popup menu buttons
manuel companys
mcompanys at mac.com
Mon Jan 27 12:50:01 EST 2003
Le Sunday, 26 Jan 2003, à 12:23 US/Central, Ken Ray a écrit :
> If you're using an "option" menu button (which will automatically
> display
> its label based on the selection you make), you can "set the
> menuHistory" of
> the button to a number indicating the line of text in the button's
> menu that
> you want.
Great! This works also with my ComboBox menus! And it's more better
than the work around I had found: adding to the handler;
<put word 2 of the selectedline of me into line n>. Then I had just to
execute
<set label of btn b to line (line n of btn b) of btn b>.
My problem was to be able to change the contents of a btn keeping the
same line of it as the label, because at any change of the contents the
selectedline was reset to 1. In my case, if btn "currency" was set to
"Libra" and the user switched to "English" I wanted the btn to show
"Pound" and not "Euro", and trigger the corresponding conversion in the
text shown in a field. The menuItem solution is better because it
really commands the selection and not only the label, and also because
you don't have to use a btn's line to store it, since you get it before
the change.
But infortunately I have found no way of solving the other problems
which looks like a bug or a corrupted software, somewhere: The use of
the btn is crazy: sometimes it works okay, sometimes it has no effect,
sometimes it switches the textalign from right to left, sometimes it
switches to the first line no matter which line is clicked, sometimes
it wokrs, but partially: I put in the handler the line <put the
menuhistory of me>: 3 things may happen
a) everithing is okay
b) no effect on the btn, the msg shows the number corresponding to the
previous selection
c) partial effect: the msg shows the number corresponding to the
selection, but the label switches to the first line; then type "put the
menuhistory of btn n" I get 1. I thought the handler does the selection
OK and then forgets about it and goes back to the default 1, but it is
not so: I've tryed put the line <set label of me to...> just before the
<put the menuhistory...> and the behavior is the same!
It is the same using the selectline, instead of the menuhistory, too.
This annoying behavior began yesterday morning with no apparent reason.
When a create another btn, it works OK.
Anyway, you've been of great help by letting me know about the
menuhistory and menupick. Thank you!
Manuel
More information about the use-livecode
mailing list