Code: Select all
Structure PB_GadgetStructure
Gadget.l ; OS Gadget pointer (HWND)
*VirtualTable
CustomData.l ; Can be used to store extra infos on this gadget
CustomData2.l ; Can be used to store extra infos on this gadget
EndStructure
#MyGadget = 1
OpenWindow(0, 0, 0, 300, 300, #PB_Window_SystemMenu|#PB_Window_Screencentered, "example")
CreateGadgetList(WindowID())
TreeGadget(#MyGadget, 0, 0, 300, 300)
; _PB_Gadget ObjectsArea is a pointer to an array of PB_GadgetStructur structures.
; one for each gadget.
; We move that value to the GadgetBase variable
;
GadgetBase.l
!extrn _PB_Gadget_ObjectsArea
!mov eax, [_PB_Gadget_ObjectsArea]
!mov [v_GadgetBase], eax
; calculate the offset of the PB_GadgetStructure for our Gadget:
;
*MyGadget.PB_GadgetStructure = GadgetBase + SizeOf(PB_GadgetStructure) * #MyGadget
Debug *MyGadget\Gadget
Debug GadgetID(#MyGadget)
Repeat
Until WaitWindowEvent() = #PB_EventCloseWindow
The virtualtable member is a pointer to the list of functions for this
Gadget.
The CustomData and CustomData2 members are for the internal use
of the Gadget functions. So they can store values for each gadget.
TreeGadget for example stores the Item count in the CustomData
member, because the API function that count's tree items only returns
16bit values, and so limits the number of entrys to 65535 entrys. But
because the item count is stored here, the full 32bit range is avaiable.
CustomData2 contains a pointer to some internal data.
I can't tell you much about what other Gadgets store there, as i don't
know their sources
btw, wha exactly do you want to do?
Timo