Basic Univers
Structure GadgetFunctions
     FreeGadget.l
     GetGadgetState.l
     SetGadgetState.l
     GetGadgetText.l
     SetGadgetText.l
     AddGadgetItem.l
     AddGadgetItem2.l
     RemoveGadgetItem.l
     ClearGadgetItemList.l
     ResizeGadget.l
     CountGadgetItems.l
     GetGadgetItemState.l
     SetGadgetItemState.l
     GetGadgetItemText.l
     SetGadgetItemText.l
     OpenGadgetList2.l
     GadgetX.l
     GadgetY.l
     GadgetWidth.l
     GadgetHeight.l
     HideGadget.l
EndStructure

Structure PB_GadgetStructure
     Gadget.l    ; OS Gadget pointer (HWND)
     *VirtualTable.GadgetFunctions
     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

Procedure.l GetGadgetStructure(GadgetID)
     GadgetID(GadgetID)
     !MOV Eax, Edx
     ProcedureReturn
EndProcedure

;{ MyTextSetGadgetText
Global *Gadget.PB_GadgetStructure, Text.s

Goto MyTextSetGadgetText_End
MyTextSetGadgetText:
!LEA Eax, dword[Esp + 4]
!MOV dword[p_Gadget], Eax
!MOV Eax, dword[Esp + 8]
!MOV dword[v_Text], Eax

SetWindowText_(*Gadget\Gadget, ":P")

!RET 08
MyTextSetGadgetText_End: ;}

CreateGadgetList(OpenWindow(0, 0, 0, 200, 200, #PB_Window_ScreenCentered|#PB_Window_SystemMenu, ""))
TextGadget(0, 90, 90, 20, 20, "~")

*Gadget.PB_GadgetStructure = GetGadgetStructure(0)
Debug *Gadget\Gadget
Debug GadgetID(0)
*Gadget\VirtualTable\SetGadgetText = ?MyTextSetGadgetText
SetGadgetText(0, ":)")

Repeat
     Select WaitWindowEvent()
          Case #PB_Event_CloseWindow
               Quit = 1
     EndSelect
Until Quit