[Gambas-user] Settings with VSplit control

Benoît Minisini gambas at ...1...
Sun Dec 12 02:15:27 CET 2010


> Hi,
> 
> How to save the layout of VSplit?
> I tried:
> 
> SUB Form_Open()
> vsplit1.settings = Settings["Group/Key"];
> PRINT Settings["Group/Key"] ' (1)
> PRINT vsplit1.settings ' (2)
> END
> 
> Of course
> 
> SUB Form_Close()
> Settings["Group/Key"] = vsplit1.settings
> END
> 
> In running, (1) and (2) are different, all numbers in (2) are smaller than
> (1). After some running, numbers in (2) decrease.
> 
> I tried Settings.Read(vsplit1.window) too but I think that it saves its
> location and size, not its content layout.
> 
> Gambas 2.22.
> Thanks!

When writing to the splitter Settings property, the values of the layout are 
relatives. I mean that setting "1,2" or setting "2,4" has exactly the same 
result: 1/3 of the total size for the first pane, and 2/3 fot the other one.

When reading the Settings property, you normally get the true sizes. As pixel 
sizes are integers, you don't get necessarily the same result.

For example, if your splitter has 329 pixels to share, setting the layout to 
"1,2", or "2,4", or "200,400" will result in 110 pixels to the first pane and 
219 pixels to the second pane. And so, when you will read the Settings 
property later, you will get "110,219".

Does that explanation make things clearer?

-- 
Benoît Minisini




More information about the User mailing list