CreateImageMenu()

Syntax

Result = CreateImageMenu(#Menu, WindowID [, Flags])
Description
Creates a new empty menu on the given window with support for images in the menu items.

Parameters

#Menu A number to identify the new menu. #PB_Any can be used to auto-generate this number.
WindowID The window for the new menu. It can be obtained using the WindowID() function.
Flags (optional) This can be a combination of the following values:
  #PB_Menu_ModernLook: Enable gradient and modern look (only has an effect on Windows)

Return value

Nonzero if the menu was successfully created, zero otherwise. If #PB_Any was used for the #Menu parameter then the generated number is returned on success.

Remarks

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() to populate the menu.

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

See Also

CreateMenu(), CreatePopupMenu(), CreatePopupImageMenu(), FreeMenu(), MenuTitle(), MenuItem(), MenuBar(), OpenSubMenu()

Supported OS

All

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