Splitter settings

Post

Posted
Rating:
#1 (In Topic #834)
Avatar
Guru
cogier is in the usergroup ‘Guru’
Does anybody know what Splitter.Settings do? It has to be an integer array, but that's all I can work out.
Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Regular
stevedee is in the usergroup ‘Regular’

cogier said

Does anybody know what Splitter.Settings do? …
I think it just holds the same splitter data as .Layout

For example, have a play with this:-

Code (gambas)

  1. Public Sub Form_Open()
  2. Dim iArray As Integer[]
  3.  
  4.   HSplit1.Layout = [50, 50]
  5.  
  6.   ' iArray = HSplit1.Layout
  7.   iArray = HSplit1.Settings
  8.  
  9.   Me.Text = iArray[0] & "," & iArray[1]
  10.  
Online now: No Back to the top

Post

Posted
Rating:
#3
Avatar
Guru
cogier is in the usergroup ‘Guru’
Thanks Steve, but it does not work. The iArray remains empty with either a Splitter or the deprecated HSplit.

<IMG src="https://www.cogier.com/gambas/Splitter1.png"> </IMG>
Online now: No Back to the top

Post

Posted
Rating:
#4
Avatar
Expert
Quincunxian is in the usergroup ‘Expert’
The Layout parameter is used as a percentage so:
Splitter1.Layout[20,80] will give the two child controls the available space based on a percentage calculation.
The Splitter1.Settings[0] will equal the actual size of the first child control width being used.

Note# I'm using the old HSplit control ( had not noticed that it had been depreciated.)

Code (gambas)

  1.   Hsp_Main.Height = Me.Height
  2.   Hsp_Main.Width = Me.Width
  3.   Hsp_Main.Layout = [16, 84]
  4.   Message(Hsp_Main.Settings[0] & " " & Hsp_Main.Settings[1]) '<---<<< this gives the actual size of the controls- the widths in this case.
  5.  

I'm assuming that if you set the split orientation to vertical, then the settings parameter would give the height of the controls.

Cheers - Quin.
I code therefore I am
Online now: No Back to the top

Post

Posted
Rating:
#5
Avatar
Guru
cogier is in the usergroup ‘Guru’
Thanks guys, you are correct, the .Layout and .Settings are the same. I had to put controls in the splitter to get the values.

For anybody who's interested, here is a little program that shows this.

<IMG src="https://www.cogier.com/gambas/SplitterSettings.png"> </IMG>

Attachment

EDIT: - Help pages now updated.
Online now: No Back to the top

Post

Posted
Rating:
#6
Guru
BruceSteers is in the usergroup ‘Guru’
any .Settings property of a control is for use with Settings.Write() and Settings.Read()

See here /comp/gb.settings/settings/write - Gambas Documentation where it explains…
"This method can handle Window objects, or any control having a Settings property."

So you can use the command…
Settings.Write(Splitter1) on form close and
Settings.Read(Splitter1) on form load
Online now: No Back to the top
1 guest and 0 members have just viewed this.