CreateMenu()
Syntax
Result = CreateMenu(#Menu, WindowID)Description
Creates a new empty menu on the given window. If #PB_Any is used as the '#Menu' parameter, the new menu number will be returned as 'Result' - if the menu can't be created 'Result' will be 0. WindowID can be obtained with the WindowID() function from the Window library. Once created, this menu becomes the current menu for further item additions. It's now possible to use functions such as MenuTitle(), MenuItem(), MenuBar(), OpenSubMenu() etc...
To handle menu events properly, see the description of following functions:
WaitWindowEvent() (alternatively WindowEvent())
EventWindow()
EventMenu()
Example:If OpenWindow(0, 200, 200, 200, 100, "Menu Example") If CreateMenu(0, WindowID(0)) ; menu creation starts.... MenuTitle("Project") MenuItem(1, "Open" +Chr(9)+"Ctrl+O") MenuItem(2, "Save" +Chr(9)+"Ctrl+S") MenuItem(3, "Save as"+Chr(9)+"Ctrl+A") MenuItem(4, "Close" +Chr(9)+"Ctrl+C") EndIf Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow EndIf
Supported OS
All