#PB_Splitter_FirstMinimumSize doesn't work for vertical spit

Just starting out? Need help? Post your questions and find answers here.
Joris
Addict
Addict
Posts: 885
Joined: Fri Oct 16, 2009 10:12 am
Location: BE

#PB_Splitter_FirstMinimumSize doesn't work for vertical spit

Post by Joris »

Hi,

As the title says :
The #PB_Splitter_FirstMinimumSize doesn't work for vertical spit.

Greatings.

Code: Select all

Procedure Build_Window_1(x = 0, y = 0, width = 1400, height = 700)
  Window_1 = OpenWindow(#PB_Any, #PB_Ignore, #PB_Ignore, width, height, "", #PB_Window_SystemMenu |#PB_Window_ScreenCentered)
  btn_000 = ButtonGadget(#PB_Any,  5,  15,  90,  20, "Read Clipboard")
  btn_001 = ButtonGadget(#PB_Any,  5,  43,  90,  20, "gadget_001")
  btn_002 = ButtonGadget(#PB_Any,  5,  71,  90,  20, "gadget_002")
  btn_003 = ButtonGadget(#PB_Any,  5,  99,  90,  20, "gadget_003")
  lvi_004 = ListViewGadget(#PB_Any, 0,0,0,0)
  lci_005 = ListIconGadget(#PB_Any, 0,0,0,0, "0", 70, #PB_ListIcon_MultiSelect |#PB_ListIcon_GridLines)
    
  splt=SplitterGadget(#PB_Any, 110, 5,width-120, height -20, lvi_004, lci_005, #PB_Splitter_Separator |#PB_Splitter_Vertical)
  SetGadgetAttribute(splt, #PB_Splitter_FirstMinimumSize, 50) ;minimum hoogte onderste lijst
  ;ResizeGadget(splt,#PB_Ignore, #PB_Ignore, WindowWidth(Window_1)-220, #PB_Ignore) 
  
EndProcedure
Procedure EventLoop()
 
  Build_Window_1()
  
  Repeat
    Select WaitWindowEvent()
      Case #PB_Event_Gadget
        Select EventGadget()
          Case btn_000 :  
          Case btn_001 : 
          Case btn_002 :
          Case btn_003 :
          Case lvi_004 : 
          Case lci_005 :  
        EndSelect
      Case #PB_Event_Menu
      Case #PB_Event_CloseWindow
        CloseWindow(#PB_All)
        End
    EndSelect
  ForEver
EndProcedure
;************************************************************************
EventLoop()
Yeah I know, but keep in mind ... Leonardo da Vinci was also an autodidact.
Joris
Addict
Addict
Posts: 885
Joined: Fri Oct 16, 2009 10:12 am
Location: BE

Re: #PB_Splitter_FirstMinimumSize doesn't work for vertical

Post by Joris »

Second not working example.

Code: Select all

Global.i lci_005, lci_006, splt, Window_1 

Procedure Build_Window_1(x = 0, y = 0, width = 1200, height = 700)
  Window_1 = OpenWindow(#PB_Any, #PB_Ignore, #PB_Ignore, width, height, "", #PB_Window_SystemMenu |#PB_Window_ScreenCentered | #PB_Window_SizeGadget | #PB_Window_MinimizeGadget |#PB_Window_MaximizeGadget)

  lci_005 = ListIconGadget(#PB_Any, 0, 0, 0, 0, "0", 70, #PB_ListIcon_FullRowSelect |#PB_ListIcon_GridLines)
  lci_006 = ListIconGadget(#PB_Any, 0, 0, 0, 0, "0", 70, #PB_ListIcon_FullRowSelect |#PB_ListIcon_GridLines)
  ;lci_005 = ListIconGadget(#PB_Any,120, 6,970, 670, "0", 70, #PB_ListIcon_FullRowSelect |#PB_ListIcon_GridLines)
  ;lci_006 = ListIconGadget(#PB_Any,120, 6,970, 670, "0", 70, #PB_ListIcon_FullRowSelect |#PB_ListIcon_GridLines)
  ;lci_005 = ListViewGadget(#PB_Any, 0,0,0,0)
  ;lci_006 = ListViewGadget(#PB_Any, 0,0,0,0)
  ;lci_005 = ButtonGadget(#PB_Any,  5,  15,  90,  20, "Read Clipboard")
  ;lci_006 = ButtonGadget(#PB_Any,  5,  43,  90,  20, "gadget_001")
  ;splt=SplitterGadget(#PB_Any, 120, 6,width-130, height-30, lci_005, lci_006, #PB_Splitter_Separator)
  splt=SplitterGadget(#PB_Any, 120, 6,970, 670, lci_005, lci_006, #PB_Splitter_Separator)
  SetGadgetAttribute(splt, #PB_Splitter_SecondMinimumSize, 20) 

EndProcedure
Procedure EventLoop()
  
  Build_Window_1()
  
  Repeat
  Select WaitWindowEvent()
  Case #PB_Event_CloseWindow
    CloseWindow(#PB_All)
    End
EndSelect
ForEver

EndProcedure

EventLoop()
Yeah I know, but keep in mind ... Leonardo da Vinci was also an autodidact.
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4636
Joined: Sun Apr 12, 2009 6:27 am

Re: #PB_Splitter_FirstMinimumSize doesn't work for vertical

Post by RASHAD »

Hi Joris
It is working as expected
SetGadgetAttribute() changes the splittergadget characteristics
So SetGadgetAttribute(splt, #PB_Splitter_FirstMinimumSize, 50) means that the first object size can not resized less than 50 later on
by using the splitter bar
It does not resize the object at start (If you mean that)

See the next example you can not go beyond 50

Code: Select all

Global.i lci_005, lci_006, splt, Window_1

Procedure Build_Window_1(x = 0, y = 0, width = 1200, height = 700)
  Window_1 = OpenWindow(#PB_Any, #PB_Ignore, #PB_Ignore, width, height, "", #PB_Window_SystemMenu |#PB_Window_ScreenCentered | #PB_Window_SizeGadget | #PB_Window_MinimizeGadget |#PB_Window_MaximizeGadget)

  lci_005 = ListIconGadget(#PB_Any, 0, 0, 0, 0, "0", 70, #PB_ListIcon_FullRowSelect |#PB_ListIcon_GridLines)
  lci_006 = ListIconGadget(#PB_Any, 0, 0, 0, 0, "0", 70, #PB_ListIcon_FullRowSelect |#PB_ListIcon_GridLines)
  ;lci_005 = ListIconGadget(#PB_Any,120, 6,970, 670, "0", 70, #PB_ListIcon_FullRowSelect |#PB_ListIcon_GridLines)
  ;lci_006 = ListIconGadget(#PB_Any,120, 6,970, 670, "0", 70, #PB_ListIcon_FullRowSelect |#PB_ListIcon_GridLines)
  ;lci_005 = ListViewGadget(#PB_Any, 0,0,0,0)
  ;lci_006 = ListViewGadget(#PB_Any, 0,0,0,0)
  ;lci_005 = ButtonGadget(#PB_Any,  5,  15,  90,  20, "Read Clipboard")
  ;lci_006 = ButtonGadget(#PB_Any,  5,  43,  90,  20, "gadget_001")
  ;splt=SplitterGadget(#PB_Any, 120, 6,width-130, height-30, lci_005, lci_006, #PB_Splitter_Separator)
  splt=SplitterGadget(#PB_Any, 120, 6,970, 670, lci_005, lci_006, #PB_Splitter_Separator)
  SetGadgetAttribute(splt, #PB_Splitter_SecondMinimumSize, 50)
  SetGadgetState(splt,150)  ;To change the Position

EndProcedure
Procedure EventLoop()
 
  Build_Window_1()
 
  Repeat
  Select WaitWindowEvent()
  Case #PB_Event_CloseWindow
    CloseWindow(#PB_All)
    End
EndSelect
ForEver

EndProcedure

EventLoop()
Egypt my love
Joris
Addict
Addict
Posts: 885
Joined: Fri Oct 16, 2009 10:12 am
Location: BE

Re: #PB_Splitter_FirstMinimumSize doesn't work for vertical

Post by Joris »

Rashad the manual says :
#PB_Splitter_FirstMinimumSize : Sets the minimum size (in pixels) than the first gadget can have.
#PB_Splitter_SecondMinimumSize: Sets the minimum size (in pixels) than the second gadget can have.

Strangly enough I was able to get this working once like should. Afterwords realy no more ???

Now your example works fine and shows me what I must have forgotten :
SetGadgetState(splt,20) ;To change the Position

I (was sure to have) used only this one SetGadgetAttribute(..)

Thanks.
Yeah I know, but keep in mind ... Leonardo da Vinci was also an autodidact.
Post Reply