Option Menu Button value

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
palanolho
Posts: 122
Joined: Sat Apr 27, 2013 11:40 pm

Option Menu Button value

Post by palanolho » Tue Dec 17, 2013 11:43 pm

Greetings everyone.

I'm having some trouble with Option Menu bottons...

I know how to get the current index of the selected options of an option menu (using the menuHistory)

However,

- How do I get the value of the current selected item OR the value corresponding to index N?
- How can can I get the index of option "ABC"


Thanks in advance for any help.

- Miguel Pinto

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Option Menu Button value

Post by Klaus » Tue Dec 17, 2013 11:50 pm

Hola Miguel,

what do you mean by "index" of an option button?
You can query the current LABEL of that button if that is what you mean?


Best

Klaus

palanolho
Posts: 122
Joined: Sat Apr 27, 2013 11:40 pm

Re: Option Menu Button value

Post by palanolho » Wed Dec 18, 2013 2:42 pm

The menuHistory of a button returns the index of the selected option, correct?

So, I would like to be able to get the value of the button given the index or vice versa

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Option Menu Button value

Post by Klaus » Wed Dec 18, 2013 4:19 pm

Hola Miguel,
palanolho wrote:The menuHistory of a button returns the index of the selected option, correct?
ah, yes, sure!
palanolho wrote:So, I would like to be able to get the value of the button given the index or vice versa
OK, just check "the text of btn xyz" = its menuitems!

With a number (menuhistory) in a variable named "tMenuH":
...
put the text of btn "your option button here" into tOptions
answer line tMenuH of tOptions
...
With a menuitem:
...
## We use LINEOFFSET
put the text of btn "your option button here" into tOptions
set the wholematches to TRUE
answer lineoffset("name of menu item",tOptions)
...

Best

Klaus

Post Reply