Button Basics?
Jan Schenkel
janschenkel at yahoo.com
Tue Aug 19 01:23:00 EDT 2003
--- "lbrehmer at rof.net" <lbrehmer at rof.net> wrote:
> I can't seem to select individual items of a pop-up
> menu button to enter
> their scripts in
> the script editor. I tried
>
> select menuItem X of button "Button Y"
>
> in the message box, but when I open the script
> editor, it's just for the
> whole button, not
> the individual items in the button. What am I
> missing?
>
Hiya,
You cannot set individual scripts for each item ;
you'll have to script the menu as a whole, and handle
the 'menuPick' message.
Suppose you have a menu with items :
Alpha
Beta
Gamma
Delta
Example script for that menu button :
on menuPick pWhichItem
switch pWhichItem
case "Alpha"
-- the user chose the item labeled "Alpha"
-- do what needs done here, before 'break'
break
case "Beta"
-- the user chose the item labeled "Beta"
-- do what needs done here, before 'break'
break
case "Gamma"
-- the user chose the item labeled "Gamma"
-- do what needs done here, before 'break'
break
case "Delta"
-- the user chose the item labeled "Delta"
-- do what needs done here, before 'break'
break
end switch
end menuPick
----
An alternative way of scripting the individual items
is the following :
- make individual handlers for what each item needs to
do, in the card script
- put the names of these handlers as a
return-delimited list into a custom property named
"uMenuMessages" in the menu button
- set the script of the menu button to
on menuPick
put the menuHistory of me into tPickedLine
put line tPickedLine of the uMenuMessages \
of me into tMenuMessage
send tMenuMessage to this card
end menuPick
----
For more information than you may ever want to know
regarding menus, fire up the Revolution Documentation,
go to the section 'Development Guide' and click on the
item 'Menus' in the left-hand list.
Hope this helped,
Jan Schenkel.
=====
"As we grow older, we grow both wiser and more foolish at the same time." (La Rochefoucauld)
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
More information about the use-livecode
mailing list