CreateImageMenu()

Syntax

Result = CreateImageMenu(#Menu, WindowID [, Flags])
Description
Creates a new empty menu on the given window, with image support for its items. 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.

'Flags' can be a combination of the following values:
  #PB_Menu_ModernLook: Enable gradient and modern look
To handle menu events properly, see the description of following functions:
WaitWindowEvent() (alternatively WindowEvent())
EventWindow()
EventMenu()

Example:
  If LoadImage(0, OpenFileRequester("Choose an icon file", "", "", 0))
    If OpenWindow(0, 200, 200, 200, 100, "Image menu Example")
      If CreateImageMenu(0, WindowID(0))    ; menu creation starts....
        MenuTitle("Project")
          MenuItem(1, "Open"   +Chr(9)+"Ctrl+O", ImageID(0))
          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
  EndIf

Supported OS

All

<- CloseSubMenu() - Menu Index - CreateMenu() ->