A little hint : Don't use datatype LONG for handles! They may work on machines with more than 2 GB or not...
And with this little change, the Gadget can handle also #PB_Any
Code: Select all
Procedure xButtonGadget(xbtn_ID, X.d, Y.d, Width.l, Height.l, Text$ = "", ImageNumber = 0)
Protected ID = CanvasGadget(xbtn_ID, X, Y, Width, Height) ; Change
If Gadget = #PB_Any : Gadget = ID : EndIf ; Added
If ID ; Change
If AddElement(xButtonList())
xButtonList()\ID = Gadget ; Change
xButtonList()\Width = Width
xButtonList()\Height = Height
...