scripting menu items (was no subject)

Sarah sarahr at genesearch.com.au
Sun Aug 17 19:03:01 EDT 2003


> I am trying to make a popup button but I can't seem to get the scripts 
> for
> the individual
> menu items in place. I assumed that once the button is made and the 
> items
> are listed,
> I would be able to access the items individually with the message box:
>
> select menuItem X of button "Y"
>
> and then open the script editor, but I don't get the script editors 
> for the
> menu items, just
> a single one for the whole button.  How can I select an individual menu
> item and open
> its scrip editor?
>
You don't script individual menu items, you script for the entire 
menu/popup buttons using a menuPick handler followed by a switch or an 
if..then construction.
e.g.
on menuPick pChoice
	switch pChoice
	case "Item 1"
	-- do item 1 stuff
	break
	case "Item 2"
	-- do item 2 stuff
	break
	end switch
end menuPick

The parameter sent to menuPick is the item picked. If it is a sub-menu 
item, you get the two portions separated by |

Cheers,
Sarah
sarahr at genesearch.com.au
http://www.troz.net/Rev/




More information about the use-livecode mailing list