Return selected item of option menu

martin at clconline.biz martin at clconline.biz
Fri Nov 12 13:42:01 EST 2004


Ken Ray <kray at sonsothunder.com> wrote on 12.11.2004, 19:27:40:
> On 11/12/04 11:29 AM, "Kaveh Bazargan"  wrote:
> 
> > Thanks everyone. :-)
> > 
> > Label was the easy answer I was looking for, and I think MenuHistory sounds
> > interesting too.
> 
> Kaveh,
> 
> You (and others) should be careful about using the label on popup buttons IF
> you have code that manipulates it... for example, I have code that restricts
> the width of a popup button to a certain number of pixels, and truncates the
> label and adds ellipses to make sure the text doesn't get cut off.
> 
> In *this* situation, you *don't* want to get the label of the button, since
> you might get the shortened version with ellipses. My suggestion would be to
> always use the "selectedText" of the button. This will always give you the
> full text of the item that is currently active on the button, *even* if the
> label has been changed. MenuHistory only gives you the index number to the
> line that is currently active.
> 
> So suppose you had a popup button with three lines of text in it:
> 
>   Test first line
>   This is a really long line
>   Third line of data
> 
> Using my truncation routines, if I selected the second option, the label of
> the button might read "This is a really lon...". So here's the different
> access methods to get the currently active line:
> 
>   put the label of btn 1
>     --> This is a really lon...
> 
>   put the menuHistory of btn 1
>     --> 2
> 
>   put the selectedText of btn 1
>     --> This is a really long line
> 
>   put line (the menuHistory of btn 1) of btn 1
>     --> This is a really long line
> 
> Hope this helps,
> 
> Ken Ray
> Sons of Thunder Software
> Web site: http://www.sonsothunder.com/
> Email: kray at sonsothunder.com
> 
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
-- 
Hi Guys thanks for the tip - I didnt ask for it tho.
Regards
Martin


More information about the use-livecode mailing list