Splitter and Resizing
Posted: Thu Nov 09, 2017 2:02 am
Hi.
I'm playing around with multiple splitters and can't get it quite right.
Below is some example code, but it has problems, all in the right pane. For example, the sub-panels aren't centered, the lower box isn't sized correctly, the resize behavior isn't quite right. Looking at the PB IDE, I get that this stuff is possible, but I am coming up short in how to get it done.
Any help appreciated.
TIA .. mark.
I'm playing around with multiple splitters and can't get it quite right.
Below is some example code, but it has problems, all in the right pane. For example, the sub-panels aren't centered, the lower box isn't sized correctly, the resize behavior isn't quite right. Looking at the PB IDE, I get that this stuff is possible, but I am coming up short in how to get it done.
Any help appreciated.
TIA .. mark.
Code: Select all
#WinOpts = #PB_Window_SystemMenu | #PB_Window_SizeGadget
Declare ResizeGadgetsmainWin()
Global mainWin
Enumeration
#winMain
#liLeft
#edLog
#pnLeft
#contRight
#pnRight
#SplitA
#SplitB
EndEnumeration
#SplitAOpts = #PB_Splitter_Vertical
#minPnRight = 600
#minEdLog = 200
Procedure OpenmainWin(x=50, y=50, w=1200, h=800)
mainWin = OpenWindow(#winMain, x, y, w, h, "write-o-matic", #WinOpts)
PanelGadget(#pnLeft, 0, 0, 0, 0)
AddGadgetItem(#pnLeft, -1, "P1")
AddGadgetItem(#pnLeft, -1, "P2")
CloseGadgetList()
ContainerGadget(#contRight, 0, 0, 0, 0)
PanelGadget(#pnRight, 0, 0, 0, 0)
AddGadgetItem(#pnRight, -1, "Tab1")
AddGadgetItem(#pnRight, -1, "Tab2")
CloseGadgetList()
EditorGadget(#edLog, 0, 0, 0, 0)
SplitterGadget(#SplitB, 0, 0, 0, 0, #pnRight, #edLog)
SetGadgetAttribute(#SplitB, #PB_Splitter_FirstMinimumSize, #minPnRight)
SetGadgetAttribute(#SplitB, #PB_Splitter_SecondMinimumSize, #minEdLog)
CloseGadgetList()
SplitterGadget(#SplitA, 0, 0, w, h, #pnLeft, #contRight, #SplitAOpts)
EndProcedure
Procedure mainWinResize()
Protected.i fww, fwh, bnd=5
fww = WindowWidth(#winMain) - bnd
fwh = WindowHeight(#winMain) - bnd
ResizeGadget(#SplitA, bnd, bnd, fww, fwh)
ResizeGadget(#SplitB, bnd, bnd, fww, fwh)
EndProcedure
OpenmainWin()
mainWinResize()
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_SizeWindow
mainWinResize()
EndSelect
Until Event = #PB_Event_CloseWindow