Who understands the splittergadget?

Just starting out? Need help? Post your questions and find answers here.
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4792
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Who understands the splittergadget?

Post by Fangbeast »

The splitter gadget function seems to act like a virtual viewport so absolute gadget positioning doesn't matter and using the visual IDE isn't needed.

I don't quite understand the positioning though, been fiddling and not getting it right.

Code: Select all

If OpenWindow(0, 100, 120, 640, 480, #PB_Window_SystemMenu | #PB_Window_SizeGadget, "SGD")
  If CreateGadgetList(WindowID())
    
    ListIconGadget(0, 115, 10, 100, 190, "Test", 100)
      AddGadgetItem(0, -1, "List Icon Gadget 1")
    
    ListIconGadget(1, 115, 10, 100, 190, "Test", 100)
      AddGadgetItem(1, -1, "List Icon Gadget 2")
    
        TreeGadget(3, 115, 10, 100, 190)
          AddGadgetItem(3, -1, "This is a tree")

;                  gadget x   y   width   height  gadget1 gadget2 flags
    SplitterGadget(2,     0,  0,  0,      0,      3,      0,      #PB_Splitter_Vertical)
    SplitterGadget(4,     0,  0,  640,    480,    2,      1)

  EndIf
  
  Repeat
    EventID = WaitWindowEvent()
    If EventID = #PB_Event_Gadget
      Select EventGadgetID()
      EndSelect
    EndIf
  Until EventID = #PB_EventCloseWindow

EndIf

End  
This produces the desired visual effect. But I am not sure how to adjust this virtual viewport to come up with the first gadget on the left (The treegadget) to the width I want it started at.

Anyone got a clue please?
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
freak
PureBasic Team
PureBasic Team
Posts: 5948
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

The Splitter bar is automatically put right in the middle of the whole
Splitter area. To set it to a specific position, you can use
SetGadgetState() after creating the Splitter.

Timo
quidquid Latine dictum sit altum videtur
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4792
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Ahh, I see the llight

Post by Fangbeast »

Okay, I get it. Illogical it may be to me :):) Thanks Freak :):)
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
Post Reply