Page 1 of 1

Who understands the splittergadget?

Posted: Sat Jun 07, 2003 7:00 am
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?

Posted: Sat Jun 07, 2003 7:53 am
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

Ahh, I see the llight

Posted: Sat Jun 07, 2003 9:09 am
by Fangbeast
Okay, I get it. Illogical it may be to me :):) Thanks Freak :):)