Hi there,
I would also prefer a proper "SetMenuItemImage()", but the following code shows how to at least get the the job done without destroying and recreating the whole menu:
Code: Select all
CreateImage(0, 16, 16, 32, #PB_Image_Transparent)
CreateImage(1, 16, 16, 32)
StartDrawing(ImageOutput(1))
For y = 0 To 15
For x = 0 To 15
r.a = Random(1)-1
g.a = Random(1)-1
b.a = Random(1)-1
Plot(x, y, RGB(r,g,b))
Next
Next
StopDrawing()
OpenWindow(0, 200, 200, 200, 120, "Change Popup-Menu Image")
CreatePopupImageMenu(0, #PB_Menu_ModernLook)
MenuItem(1, "get red" , ImageID(0))
MenuItem(2, "get green", ImageID(0))
MenuItem(3, "get blue" , ImageID(0))
MenuItem(4, "get funky", ImageID(0))
MenuItem(5, "get lost" , ImageID(0))
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
End
Case #PB_Event_RightClick
DisplayPopupMenu(0, WindowID(0))
Case #PB_Event_Menu
StartDrawing(ImageOutput(0))
DrawingMode(#PB_2DDrawing_AllChannels)
Select EventMenu()
Case 1 : Box(0,0,16,16,$FF0000FF)
Case 2 : Box(0,0,16,16,$FF00FF00)
Case 3 : Box(0,0,16,16,$FFFF0000)
Case 4 : DrawImage(ImageID(1),0,0)
Case 5 : Box(0,0,16,16,0)
EndSelect
StopDrawing()
EndSelect
ForEver
...and sorry for the bad jokes inside the code...