Page 1 of 1

Splitter settings

Posted: Thursday 31st March 2022 2:30pm
by cogier
Does anybody know what Splitter.Settings do? It has to be an integer array, but that's all I can work out.

Re: Splitter settings

Posted: Thursday 31st March 2022 3:17pm
by stevedee
cogier wrote: Thursday 31st March 2022 2:30pm 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:-
Public Sub Form_Open()
Dim iArray As Integer[]

  HSplit1.Layout = [50, 50]
 
  ' iArray = HSplit1.Layout
  iArray = HSplit1.Settings

  Me.Text = iArray[0] & "," & iArray[1]

End

Re: Splitter settings

Posted: Friday 1st April 2022 2:30pm
by cogier
Thanks Steve, but it does not work. The iArray remains empty with either a Splitter or the deprecated HSplit.

Image

Re: Splitter settings

Posted: Friday 1st April 2022 11:01pm
by Quincunxian
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.)
  Hsp_Main.Height = Me.Height 
  Hsp_Main.Width = Me.Width 
  Hsp_Main.Layout = [16, 84]
  Message(Hsp_Main.Settings[0] & " " & Hsp_Main.Settings[1]) '<---<<< this gives the actual size of the controls- the widths in this case.
I'm assuming that if you set the split orientation to vertical, then the settings parameter would give the height of the controls.

Re: Splitter settings

Posted: Saturday 2nd April 2022 2:55pm
by cogier
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.

Image
NewTest-0.0.1.tar.gz
(44.28 KiB) Downloaded 227 times
EDIT: - Help pages now updated.

Re: Splitter settings

Posted: Friday 3rd June 2022 8:51am
by BruceSteers
any .Settings property of a control is for use with Settings.Write() and Settings.Read()

See here http://gambaswiki.org/wiki/comp/gb.sett ... ings/write 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