[Solved] Get hWnd of a #PB_Any gadget?
Posted: Thu Mar 05, 2020 10:00 am
How do I get the handle (hWnd) of a gadget that was created with #PB_Any? As you can see below, GadgetID() doesn't return it (but it does with hard-coded gadget numbers instead of #PB_Any). I need it so I can use SetProp_() with it. Thanks.
It works with hard-coded gadget numbers, but I need #PB_Any for my project:
Code: Select all
If OpenWindow(0, 100, 200, 300, 100, "ButtonGadget", #PB_Window_SystemMenu)
bg = ButtonGadget(#PB_Any, 10, 10, 200, 30, "Button")
Debug bg ; 38539160
Debug GadgetID(bg) ; 41945080
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Code: Select all
If OpenWindow(0, 100, 200, 300, 100, "ButtonGadget", #PB_Window_SystemMenu)
bg = ButtonGadget(0, 10, 10, 200, 30, "Button")
Debug bg ; 41945080
Debug GadgetID(0) ; 41945080
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf