Code: Select all
; When PB creates a Panel, it also create a Display-Window for each Item, that you add.
; Sometimes you need the ID of this display window, but PB doesn't have a function for this.
; I found out, that Windows give the user the ability to save a value with every tab item and
; I test it: This value is the Display window id.
; When you want to open a RichEdit (or something like this) you need a Parent-Window-ID and in a
; Panel, this parent-id is the Display-Window-ID!
; Also when you can get the size of the display-window and reopen a panel-tab to add new gadgets.
;
; BIG WARNING:
; This is a undocumented Function of PB and it can be changed in the future!
; On PB 3.62 it works perfect.
;
; @Fred: Official-Version of this Functions would be nice ;)
; When PB creates a Panel, it also create a Display-Window for each Item, that you add.
; Sometimes you need the ID of this display window, but PB doesn't have a function for this.
; I found out, that Windows give the user the ability to save a value with every tab item and
; I test it: This value is the Display window id.
; When you want to open a RichEdit (or something like this) you need a Parent-Window-ID and in a
; Panel, this parent-id is the Display-Window-ID!
; Also when you can get the size of the display-window and reopen a panel-tab to add new gadgets.
;
; BIG WARNING:
; This is a undocumented Function of PB and it can be changed in the future!
; On PB 3.62 it works perfect.
;
; @Fred: Official-Version of this Functions would be nice ;)
Procedure GetPanelDisplayWindowID(Gadget,Item) ; WARNING! Undocumentated
tc_item.tc_item
tc_item\mask=#TCIF_PARAM
SendMessage_(GadgetID(Gadget),#TCM_GETITEM,Item,tc_item)
ProcedureReturn tc_item\lparam
EndProcedure
Procedure GetInnerSizeWidth(Gadget)
rect.rect
GetWindowRect_(GetPanelDisplayWindowID(Gadget,GetGadgetState(Gadget)),rect)
ProcedureReturn rect\right-rect\left
EndProcedure
Procedure GetInnersizeHeight(Gadget)
rect.rect
GetWindowRect_(GetPanelDisplayWindowID(Gadget,GetGadgetState(Gadget)),rect)
ProcedureReturn rect\bottom-rect\top
EndProcedure
Procedure OpenPanelItem(Gadget,Item)
ProcedureReturn UseGadgetList(GetPanelDisplayWindowID(Gadget,Item))
EndProcedure
;- Small (and dirty) example:
OpenWindow(1,0,200,400,400,"hallo",#PB_Window_SystemMenu)
PanelGadget(0,0,0,400,400)
AddGadgetItem(0,-1,"Test1")
AddGadgetItem(0,-1,"Test2")
AddGadgetItem(0,-1,"Test3")
CloseGadgetList()
Width=GetInnerSizeWidth(0)
Height=GetInnersizeHeight(0)
OpenPanelItem(0,0)
ButtonGadget(1,0,0,Width,Height,"Test1")
OpenPanelItem(0,1)
ButtonGadget(1,10,10,Width-20,Height-20,"Test2")
Repeat
Select WaitWindowEvent()
Case #WM_LBUTTONDOWN
GetCursorPos_(point.point)
Debug WindowFromPoint_(point\x|point\y<<32)
Case #PB_Event_CloseWindow
End
EndSelect
ForEver