Page 1 of 1

XY Spliter

Posted: Tue Apr 15, 2025 9:37 pm
by rndrei
How to find out the current position of the XY Spliter (#SPG)?

Code: Select all

  SplitterGadget(#spg ,10,10,100,100,#panel_1,#panel_2 )

Re: XY Spliter

Posted: Tue Apr 15, 2025 10:02 pm
by BarryG
Read the manual -> https://www.purebasic.com/documentation ... adget.html

It's good to ask questions when you're stuck, but man, you aren't even trying.

Re: XY Spliter

Posted: Tue Apr 15, 2025 10:10 pm
by Quin
I agree, give the PB manual a good, long read. Even if you don't read all of it, it'll let you learn how its structure works, how to navigate it, and where all the info you want is located. There are some pieces of info that are hidden really well, like the compiler functions such as SizeOf and CopyStructure(), but this is right there.

Re: XY Spliter

Posted: Tue Apr 15, 2025 10:11 pm
by mk-soft
Press F1

Code: Select all

If OpenWindow(0, 0, 0, 230, 180, "SplitterGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  #Button1  = 0
  #Button2  = 1
  #Splitter = 2
  
  ButtonGadget(#Button1, 0, 0, 0, 0, "Button 1") ; No need to specify size or coordinates
  ButtonGadget(#Button2, 0, 0, 0, 0, "Button 2") ; as they will be sized automatically
  SplitterGadget(#Splitter, 5, 5, 220, 120, #Button1, #Button2, #PB_Splitter_Separator)
  
  TextGadget(3, 10, 135, 210, 40, "Above GUI part shows two automatically resizing buttons inside the 220x120 SplitterGadget area.",#PB_Text_Center )
  
  Repeat
    Select WaitWindowEvent()
      Case #PB_Event_CloseWindow
        Break
        
      Case #PB_Event_Gadget
        Select EventGadget()
          Case #Splitter
            Debug "Splitter Position: " + GetGadgetState(#Splitter)
            Debug "Button 1 Height: " + GadgetHeight(#Button1)
            Debug "Button 2 Height: " + GadgetHeight(#Button2)
        EndSelect
        
    EndSelect
  ForEver
  
EndIf

Re: XY Spliter

Posted: Tue Apr 15, 2025 11:34 pm
by HeX0R
Don't feed the troll.
I'm slowly really wondering how long it takes until people see what I see...

Re: XY Spliter

Posted: Wed Apr 16, 2025 2:59 am
by rndrei
Hey, I know where to read the information, but if I ask, this does not mean that I'm not trying ...

Re: XY Spliter

Posted: Wed Apr 16, 2025 4:25 am
by Quin
rndrei wrote: Wed Apr 16, 2025 2:59 am Hey, I know where to read the information, but if I ask, this does not mean that I'm not trying ...
Show us the code you're trying then. All you posted is the code to create the gadget.

Re: XY Spliter

Posted: Wed Apr 16, 2025 8:18 am
by BarryG
rndrei wrote: Wed Apr 16, 2025 2:59 amHey, I know where to read the information, but if I ask, this does not mean that I'm not trying ...
You asked: "How to find out the current position of the XY Spliter"

But one of the first items in the manual for SplitterGadget says:

Image

That's why I said you weren't trying. :wink:

Re: XY Spliter

Posted: Wed Apr 16, 2025 9:24 am
by Fred
@rndrei, if you don't do any effort for your future posting, i will remove them. The minimum to ask for help is to post at least a small working sample showing why it doesn't work as expected.