img = CatchImage(-1,?myimage)
the image is loaded, and I get a handle/id...
But if I try to use this id in CreatePopupImageMenu(), it fails.
I have to use a non negative number(ie: CatchImage(0...)) and ImageID(0) to get it to work.
Shouldn't it work the 1st way? Or what am I missing?
Code: Select all
UsePNGImageDecoder()
OpenWindow(0,100,100,300,200,"Test")
If CreatePopupImageMenu(0)
CompilerIf #true
;- this way works.
img = CatchImage(0, ?MenuCopy)
Debug ImageID(0)
Debug img
MenuItem(1, "Copy jSysLogClient() call", ImageID(0))
CompilerElse
;- this way does not work
img = CatchImage(#PB_Any, ?MenuCopy)
Debug img
MenuItem(1, "Copy jSysLogClient() call", img)
CompilerEndIf
MenuItem(2, "Use Alternate method")
MenuItem(3, "Quit")
Else
Debug "Failed to create menu"
EndIf
Repeat
Select WaitWindowEvent(10)
Case #PB_Event_CloseWindow
Break
Case #PB_Event_Menu
Select EventMenu()
Case 1 : Debug "Copy"
Case 3 : PostEvent(#PB_Event_CloseWindow)
EndSelect
Case #PB_Event_RightClick
DisplayPopupMenu(0,WindowID(0))
EndSelect
ForEver
DataSection ;- Image for menu
MenuCopy:
IncludeBinary #PB_Compiler_Home+"\Examples\Sources\Data\ToolBar\Copy.png"
EndDataSection