SplitterGadget

Just starting out? Need help? Post your questions and find answers here.
User avatar
rndrei
Enthusiast
Enthusiast
Posts: 151
Joined: Thu Dec 28, 2023 9:04 pm

SplitterGadget

Post by rndrei »

How to change the size of Splittergadget () between the panels, by default, is made equally?
dige
Addict
Addict
Posts: 1391
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Re: SplitterGadget

Post by dige »

That would interest me too. I'm afraid it won't be possible.
"Daddy, I'll run faster, then it is not so far..."
firace
Addict
Addict
Posts: 946
Joined: Wed Nov 09, 2011 8:58 am

Re: SplitterGadget

Post by firace »

SetGadgetState

Code: Select all

OpenWindow(0, 100, 100, 400, 300, "Splitter Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)

StringGadget(1, 0, 0, 0, 0, "Left Panel", #PB_Text_Center)
StringGadget(2, 0, 0, 0, 0, "Right Panel", #PB_Text_Center)

SplitterGadget(3, 10, 10, 380, 180, 1, 2, #PB_Splitter_Vertical)

SetGadgetState(3, 80)

Repeat
  Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
User avatar
rndrei
Enthusiast
Enthusiast
Posts: 151
Joined: Thu Dec 28, 2023 9:04 pm

Re: SplitterGadget

Post by rndrei »

Thank you for what you need!
BarryG
Addict
Addict
Posts: 4118
Joined: Thu Apr 18, 2019 8:17 am

Re: SplitterGadget

Post by BarryG »

dige wrote: Thu Apr 10, 2025 8:37 amI'm afraid it won't be possible
What? Of course it is. To modify firace's example:

Code: Select all

width = Random(380,200) ; Choose a random width between 200 and 380 pixels.

OpenWindow(0, 300, 300, 400, 200, "Splitter Example", #PB_Window_Invisible | #PB_Window_SystemMenu)

StringGadget(1, 0, 0, 0, 0, "Left", #PB_Text_Center)
StringGadget(2, 0, 0, 0, 0, "Right", #PB_Text_Center)

SplitterGadget(3, 10, 10, width, 180, 1, 2, #PB_Splitter_Vertical)

SetGadgetState(3, (width/2)-3)
ResizeWindow(0, #PB_Ignore, #PB_Ignore, width+20, #PB_Ignore)

HideWindow(0, #False)

Repeat
  Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
dige
Addict
Addict
Posts: 1391
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Re: SplitterGadget

Post by dige »

I'm glad that rndrei's question has been answered. I had interpreted the question differently.
I thought it was about the #PB_Splitter_Separator. I find it a bit narrow from a UI point of view and would like it to be wider...
"Daddy, I'll run faster, then it is not so far..."
BarryG
Addict
Addict
Posts: 4118
Joined: Thu Apr 18, 2019 8:17 am

Re: SplitterGadget

Post by BarryG »

dige wrote: Thu Apr 10, 2025 12:25 pmI had interpreted the question differently
Oh, I see what you mean (the splitter itself). I've never looked into that. But since he said "equally", that can only mean between two or more parts, so I assume he meant for it to be exactly in the middle of the two StringGadgets.
User avatar
rndrei
Enthusiast
Enthusiast
Posts: 151
Joined: Thu Dec 28, 2023 9:04 pm

Re: SplitterGadget

Post by rndrei »

Why doesn't it work?When clicking the button, show another gadget!
for some reason, does not work because of HideGadget () OS Linux

Code: Select all

OpenWindow(0, 100, 100, 400, 300, "Splitter Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
 ContainerGadget(1,10,32, 200,300, #PB_Container_Raised)
  ListViewGadget(2, 0, 0, 0, 60)
  EditorGadget(3, 0, 65, 0, 125)
  ListViewGadget(4, 0, 65, 0, 125)
  CloseGadgetList()
  HideGadget(4,#True)
  ButtonGadget(100,50,200,100,10,"button")
For i=1 To 30
  AddGadgetItem(2,-1,"LIST-1 VISIBLE"+Str(i))
Next i
For i=1 To 30
  AddGadgetItem(3,-1,"EDITOR! VISIBLE"+Str(i))
Next i
For i=1 To 30
  AddGadgetItem(4,-1,"LIST-2 VISIBLE"+Str(i))
Next i

 SplitterGadget(7, 10, 10, 380, 180, 2, 4)
 SplitterGadget(8, 10, 10, 380, 180, 2, 3)
 SetGadgetState(3, 20)

Repeat
  Event = WaitWindowEvent()
  Select Event
    Case #PB_Event_Gadget
      Select EventGadget()
        Case 100: 
           HideGadget(4,#False)
           HideGadget(3,#True)
    EndSelect
 EndSelect
Until Event = #PB_Event_CloseWindow
Post Reply