messed up custom menus

Richard Gaskin ambassador at fourthworld.com
Mon Jul 12 09:44:48 EDT 2004


Klaus Major wrote:

> 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 :-)

You may have stumbled across a rare thing:  a lack of robustness in 
Raney's code. :)

What recipe could I use to reproduce the side-effects you're seeing?

Have any of the other readers here encountered issues with MC's menu 
updates walking on your objects?

-- 
  Richard Gaskin
  Fourth World Media Corporation
  ___________________________________________________
  Rev tools and more:  http://www.fourthworld.com/rev


More information about the metacard mailing list