messed up custom menus

Klaus Major klaus at major-k.de
Wed Jul 14 14:36:24 EDT 2004


Hi all,

i changed the script of grp "MetaCard Menu Bar" of cd 1 of stack 
"MetaCard Menu Bar",
see below, and it looks like this works out fine :-)

## Only this one handler was making trouble, since he only checks for a 
menu named "Edit"
## which is not uncommon, especially at your own menus at home ;-)

## It's just this handler that gets called on "mousedown":

on setupedit
   local otype
   put word 1 to 2 of the selobjs into otype
   if word 1 of otype is "card" and word 2 of otype is among the items 
of "field,button,image,player,scrollbar,graphic"
   then delete word 1 of otype
   else delete word 2 of otype
   if otype is empty or otype is "card" or otype is "stack"

## Disable menuitem, i think "diable menuitem x" will ONLY work with 
real menus!
   then put "(" before line 9 of btn "Edit" of grp "MetaCard Menu Bar" 
of cd 1 of stack "MetaCard Menu Bar"
   else
## Enable menuitem:
     delete char 1 of line 9 of btn "Edit" of grp "MetaCard Menu Bar" of 
cd 1 of stack "MetaCard Menu Bar"
     if word 1 of the selobjs is "group" and the number of lines in (the 
selobjs) is 1
     then put "Un&group/G" into line 9 of btn "Edit" of grp "MetaCard 
Menu Bar" of cd 1 of stack "MetaCard Menu Bar"
     else put "&Group/G" into line 9 of btn "Edit" of grp "MetaCard Menu 
Bar" of cd 1 of stack "MetaCard Menu Bar"
   end if
   if the editBackground of the topStack
   then put "Stop Editing &BG/T" into line 10 of btn "Edit" of grp 
"MetaCard Menu Bar" of cd 1 of stack "MetaCard Menu Bar"
   else put "&Backgrounds.../T" into line 10 of btn "Edit" of grp 
"MetaCard Menu Bar" of cd 1 of stack "MetaCard Menu Bar"

   # then disable menuItem 9 of menu "Edit"
   # else
   # enable menuItem 9 of menu "Edit"
   # if word 1 of the selobjs is "group" and the number of lines in (the 
selobjs) is 1
   # then put "Un&group/G" into menuItem 9 of menu "Edit"
   # else put "&Group/G" into menuItem 9 of menu "Edit"
   # end if
   # if the editBackground of the topStack
   # then put "Stop Editing &BG/T" into menuItem 10 of menu "Edit"
   # else put "&Backgrounds.../T" into menuItem 10 of menu "Edit"
end setupedit


Hope that will be helpful to others, too...

Regards


Klaus Major
klaus at major-k.de
http://www.major-k.de



More information about the metacard mailing list