WindowMenu ( window )
Parameters
| window - window whose menu bar root you want |
Description
|
Returns the root menu of a window's menu bar. Requires Extended language mode. This is where every menu bar starts. The handle it returns is not an item you can see - it is the invisible parent that the headings hang off. Pass it as the parent_menu argument of CreateMenu to add File, Edit and View, then pass each heading's handle back to CreateMenu to fill it with commands, and finish with UpdateWindowMenu so the native bar redraws: menuRoot=WindowMenu(window) fileMenu=CreateMenu("&File",0,menuRoot) CreateMenu "&Open...",101,fileMenu UpdateWindowMenu window The root is created with the window and stays valid for its whole life, so you can call WindowMenu any time you want to add a heading - and there is no need to stash the handle in a global if it is easier to ask again. Every window has one, but the bar is only shown when the window was created with style bit 4 (included in the default CreateWindow style 15); without that bit the items you add stay hidden. There is nothing to clean up: menu handles are a different kind from gadget handles, so FreeGadget rejects them, and the whole menu tree is disposed of with the window it belongs to. See it working in the menus and events sample and the world editor shell sample. See also: CreateMenu, UpdateWindowMenu, CreatePopupMenu, CreateWindow, MenuText. |
Index