Splitter settings

Post your Gambas programming questions here.
Post Reply
User avatar
cogier
Site Admin
Posts: 1118
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Splitter settings

Post by cogier »

Does anybody know what Splitter.Settings do? It has to be an integer array, but that's all I can work out.
User avatar
stevedee
Posts: 518
Joined: Monday 20th March 2017 6:06pm

Re: Splitter settings

Post 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
User avatar
cogier
Site Admin
Posts: 1118
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Splitter settings

Post by cogier »

Thanks Steve, but it does not work. The iArray remains empty with either a Splitter or the deprecated HSplit.

Image
User avatar
Quincunxian
Posts: 171
Joined: Sunday 25th June 2017 12:14am
Location: Western Australia

Re: Splitter settings

Post 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.
Cheers - Quin.
I code therefore I am
User avatar
cogier
Site Admin
Posts: 1118
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Splitter settings

Post 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 191 times
EDIT: - Help pages now updated.
User avatar
BruceSteers
Posts: 1521
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Splitter settings

Post 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
If at first you don't succeed , try doing something differently.
BruceS
Post Reply