Option Menus

Ken Ray kray at sonsothunder.com
Mon Jun 6 10:07:33 EDT 2011


> I have another simple question. In HTML for example, when I set up an Option
> menu I can set both the Name and the Value of the each of the options in the
> list.  This give me a way to display one thing to the use but reference a
> different value on selection of that item.
> 
> In Live Code I can only set one value, not two.
> 
> This seems to me to be a rather common requirement. If I am asking users to
> select something in the menu, I want to show them something Nice but
> actually use a unique ID of some sort when they select it. So I am curious
> if the community has arrived at a common way of solving this common problem.

It's a shame you need to use Option menus, because the pulldown/popup form
has been extended to allow for abritrary tagging (as of 4.0 I believe). It's
the form:

<itemName>/<acceleratorKey>|<tag>

and if you don't want to show and <acceleratorKey>, you just omit it. So if
you were using a popup menu for example, you could put this into the button:

Apple/|red
Orange/|orange
Lemon/|yellow

and the user would only see choices for "Apple", "Orange", and "Lemon", but
if they picked "Apple", you would get "red" coming into your menupick
handler instead of "Apple".


Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/






More information about the use-livecode mailing list