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.

The dimensions of the images are 16x16 pixels.

To handle menu events properly, see the description of following functions:
WaitWindowEvent() (alternatively WindowEvent())
EventWindow()
EventMenu()

Example

  UsePNGImageDecoder()

  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", LoadImage(0, #PB_Compiler_Home + "examples/sources/Data/ToolBar/Open.png"))
        MenuItem(2, "Save"   +Chr(9)+"Ctrl+S", LoadImage(1, #PB_Compiler_Home + "examples/sources/Data/ToolBar/Save.png"))
        MenuBar()
        MenuItem(3, "Quit"  +Chr(9)+"Ctrl+Q")
    EndIf
  
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf

See Also

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

Supported OS

All

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