Option Menu Specifics
J. Landman Gay
jacque at hyperactivesw.com
Mon Feb 8 14:06:46 EST 2010
Andrew Kluthe wrote:
> Sorry for not clarifying. I am not trying to work within a datagrid this
> time. I do not understand how to modify the behaviors of controls other than
> the datagrid. There isn't a button in the property inspector for modifying
> behaviors of an option menu.
>
> I have read the lessons on behaviors and am still lacking a real
> understanding of where to find the code for handling the functionality of
> the option menu.
>
> here is the logic which I had in mind.
>
> Load gLandownerContact into the text of "optionMenu"
> on optionMenu's MouseUp (down, whatev),
> Load a the full list from DB.
Use Mark Weider's suggestion, it will work fine. I just wanted to
mention that for a single button instance like this, you don't need
behaviors at all. Behaviors are great when you have a number of controls
that need to share a single script, but if you only have one button it
is more efficient to have it just use its own script.
One basic concept that may help: buttons are containers and they can
hold text. If the button is a menu button (as option buttons are) then
the text becomes the menu item list. You can populate a button menu
simply by putting text into the button, like this:
put "one" &cr& "two" &cr& "three" into btn "myOptionButton"
This creates a 3-line list, which when put into the button, will pop
down those three lines in its menu.
Everything else you want to do is just manipulation of the text before
you put it into the button contents. If you want a particular line on
top, parse your text so it is in the right order. But more typically,
Mark's suggestion is the right one. Use the menuHistory property to set
the line that will be under the cursor when the button menu displays.
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list