Restored from previous forum. Originally posted by dige.
maybe someone need this:
Code: Select all
; Create a popupmenu with images
hWnd = OpenWindow(0, 100, 200, 300, 100, "Popmenu with Icons", #PB_Window_SystemMenu)
mHandle = CreatePopupMenu (0)
MenuItem(10, "With Icon")
MenuItem(20, "Without Icon")
MenuItem(30, "With Icon")
MenuItem(40, "Standard Icon")
ButtonGadget ( 3, 50, 30, 200, 50, "click here for popup" )
hChk = LoadImage_(0, #PB_Compiler_Home + "Examples/Sources/Data/File.bmp",0,0,0,#LR_LOADTRANSPARENT | #LR_LOADFROMFILE )
hUnChl = LoadImage_(0, #PB_Compiler_Home + "Examples/Sources/Data/Drive.bmp",0,0,0,#LR_LOADTRANSPARENT | #LR_LOADFROMFILE )
SetMenuItemBitmaps_(mHandle, 10, $10, hChk, hUnChk)
SetMenuItemBitmaps_(mHandle, 30, $10, hChk, hUnChk)
SetMenuItemState(0, 30, 1 )
SetMenuItemState(0, 40, 1 )
Repeat
EventID = WaitWindowEvent()
If EventID = #PB_Event_Gadget
DisplayPopupMenu(0, hWnd)
EndIf
Until EventID = #PB_Event_CloseWindow
End