How to add a value to an Item of a menu option button

Ken Ray kray at sonsothunder.com
Sun Dec 26 18:10:59 EST 2004


On 12/26/04 4:51 PM, "Jérôme Rosat" <jrosat at mac.com> wrote:

> Bonjour à tous,
> 
> In my database, I've got a table with two fields and many records:
> 
> Value Name
> 
> 12  Name1
> 16  Name2
> 25  Name3
> etc.
> 
> On a card I created a menu option button with items come from the field
> Name of my database:
> Menu Items:
> Name1
> Name2
> Name3
> etc.
> 
> But when I select an option, I need to now the value of the item
> selected, not the item itself.
> For example, if I select "Name2", I need to know the value "16".
> 
> How to add a value to an Item of a menu option button ?

Yes. You can add a custom property (like uMenuValue) to the option button
that contains the values, one on each line:

12
16
25

And then do this:

on menuPick
  put line (the menuHistory of me) of the uMenuValue of me into tValue
  -- gets the corresponding line in the custom property to the line selected
  -- in the option menu

  -- do something with tValue
end menuPick

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




More information about the use-livecode mailing list