Do you mean like this?
;Function CreateGadget(GID%,GIMAGE$,GX%,GY%,GW%,GH%) ;Create a Gadget ;G.GADGET = New GADGET ; G\GID% = GID% ; G\GIMAGE = LoadImage(GIMAGE$) ; G\GX% = GX% ; G\GY% = GY% ; G\GW% = GW% ; G\GH% = GH% ;Return handle(g) ;End Function function DoStuff(id%,x#,y#) g.GADGET = object.GADGET(id) if GADGET = null return ;dostuff to this gadget here end function