CreatePopupImageMenu()
Syntax
Result = CreatePopupImageMenu(#Menu [, Flags])Description
Creates a new empty popup menu, with image support for its items. If #PB_Any is used as '#Menu' parameter, the new menu number will be returned as 'Result'. If the menu can't be created then 'Result' will equal 0. When created this menu becomes active, further menu additions will occur on it. It's now possible to use functions such as MenuItem(), MenuBar(), OpenSubMenu() etc...
'Flags' can be a combination of the following values:#PB_Menu_ModernLook: Enable gradient and modern lookDisplayPopupMenu() can be used to display this popup menu at any position on the screen.
To handle menu events properly, see the description of following functions:
WaitWindowEvent() (alternatively WindowEvent())
EventWindow()
EventMenu()
Example:If OpenWindow(0, 200, 200, 200, 120, "Image Popup-Menu Example") If CreatePopupImageMenu(0, #PB_Menu_ModernLook) ; creation of the pop-up menu begins... MenuItem(1, "Open") ; You can use all commands for creating a menu MenuItem(2, "Save") ; just like in a normal menu... MenuItem(3, "Save as") MenuItem(4, "Quit") MenuBar() OpenSubMenu("Recent files") MenuItem(5, "PureBasic.exe") MenuItem(6, "Test.txt") CloseSubMenu() EndIf Repeat Select WaitWindowEvent() ; check for window events Case #WM_RBUTTONDOWN ; right mouse button was clicked => DisplayPopupMenu(0, WindowID(0)) ; now display the popup-menu Case #PB_Event_Menu ; an item of the popup-menu was clicked Select EventMenu() ; get the clicked menu item... Case 1 : Debug "Menu: Open" Case 2 : Debug "Menu: Save" Case 3 : Debug "Menu: Save as" Case 4 : Quit = 1 Case 5 : Debug "Menu: PureBasic.exe" Case 6 : Debug "Menu: Text.txt" EndSelect Case #PB_Event_CloseWindow Quit = 1 EndSelect Until Quit = 1 EndIf
Supported OS
All