Page 1 of 1

How to replace all menuItems of an option menu button?

Posted: Sat Oct 06, 2012 8:28 pm
by sritcp
I don't know how to reference the container of all menuItems.

Code: Select all

Put menuItem i of button "Choose Name"
returns the particular menuItem.
But, if I want to replace all the menuItems with the contents of a field,

Code: Select all

put field "newMenuItems" into menuItems of button "Choose Name"
doesn't work. The dictionary says that menuItem is a keyword, not a property.

How do I reference the collection of menuItems, so I can deal with them together instead of using a repeat loop?

Thanks,
Sri.

Re: How to replace all menuItems of an option menu button?

Posted: Sat Oct 06, 2012 8:57 pm
by jmburnod
Hi Sri.

Code: Select all

set the text of btn "Choose Name" to the text of field "newMenuItems" 
Best regards
Jean-Marc

Re: How to replace all menuItems of an option menu button?

Posted: Sat Oct 06, 2012 9:44 pm
by sritcp
Thanks, Jean-Marc!

Sri.

Re: How to replace all menuItems of an option menu button?

Posted: Sat Oct 06, 2012 9:57 pm
by dunbarx
What Jean-Marc said.

He populated the button by setting its text property, and that is fine. You can also do it the other way, by simply considering the button as a container, which it is, and:

put yourMenuItems into btn "yourButton".

Craig Newman

Re: How to replace all menuItems of an option menu button?

Posted: Sat Oct 06, 2012 10:02 pm
by sritcp
Amazing! I was trying all kinds of complex things!
If all else fails, try the obvious!

Thanks, Craig!

Sri.