[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl-Toolbox] Altering the Menu Bar



When a new MacWindow is created is is often necessary to revise the 
Menu Bar, particularly if the new window contains any editable text 
fields. This is easily enough done provided the ID's of the menus in 
the MenuBar are known. However situations do arise when they are not 
known. (For instance MacPerl's bar may or may not include an external 
editor menu). If so how can you find them?

GetMenuBar() will return a handle to the 'menuList', which is (I 
think) a list of handles to the individual menus. But how do you 
extract the handles from the string (returned by 'get') and the ID's 
from the handles?

The problem can be sidestepped by saving the Menu Bar ($mb = 
GetMenuBar()), deleting the whole shebang by ClearMenu() and 
eventually restoring with SetMenuBar($mb). However ClearMenu() has 
two bad effects. Firstly it deletes the Apple Menu , (which usually 
one doesn't want to do) and secondly, if the Menu Bar deleted is 
MacPerl's bar, it is restored minus the MacPerl 'Help' items. Is 
there any way of avoiding these two difficulties?

Any thoughts would be much appreciated.

Alan Fry

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-toolbox-request@macperl.org