CreateMenu()
Syntax
Result = CreateMenu(#Menu, WindowID)Description
Creates a new empty menu on the given window. If #PB_Any is used as '#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 easily obtained with the WindowID() command from the Window library. Once created, this menu becomes the current menu for building. It's now possible to use the commands like MenuTitle(), MenuItem(), MenuBar(), OpenSubMenu() etc...
To handle all menu events properly, see the description of following commands:
WaitWindowEvent() (alternatively WindowEvent())
EventWindow()
EventMenu()
Example:If OpenWindow(0, 200, 200, 200, 100, "Menu Example") If CreateMenu(0, WindowID(0)) ; here the menu creating 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