messed up custom menus

Klaus Major klaus at major-k.de
Mon Jul 12 18:33:53 EDT 2004


Hi richard,

> ...
> Without seeing the code you're using to modify your Edit menu I can 
> only guess,
> but in the past I've found that routines which modify menu buttons by 
> referring to
>  them as "menu" will work on the currently active menu bar objects, 
> which may
> not necessarily be what I want.
>
> For example, if I need to update the contents of my own Edit menu I 
> sued to write:
>
>   put tMyMenuContents into menu "Edit"
>
> But I found that if my update occurs when MC's menubar is the 
> defaultMennuBar, I'll wind up modifying that one rather than my own.
>
> So these days I tend toward very explicit references:
>
>   put tMyMenuContents into btn "Edit" of stack "MyMenuBar"

Thanks for the fast response...

But the menu is ready-made in a substack and i do not modify it in any 
way...?

Here is the script of the group "MetaCard Menu Bar" of mctools, and  
think here lies the ptroblem,
although o do not know where yet ;-)

on mouseDown
   if the short name of the target is "Help"
   then pass mouseDown
   local olddefault
   put the defaultmenubar into olddefault
   set the defaultmenubar to "MetaCard Menu Bar"
   lock menus
   if fnames is empty or button "Text" is empty then doinit

###!!!
   setupedit
   setuptext
   set the defaultStack to value(the last word of olddefault)
   set the defaultmenubar to value(word 2 of olddefault)
   --
   unlock menus
   pass mouseDown
end 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"
   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"

###!!! This appears in my medit menu with 4 empty lines before it, but 
why?
   else put "&Backgrounds.../T" into menuItem 10 of menu "Edit"
end setupedit

It happens when i switch from pointer to browse tool...
Any hints are very welcome :-)

>  Richard Gaskin

Regards

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



More information about the metacard mailing list