[Gambas-user] Settings with VSplit control

richard terry rterry at ...1946...
Sun Dec 12 11:38:49 CET 2010


Simple sample code:

Public sub Save_Settings()
      Settings["Your_Section_Name/HSplit_Main.Layout"] = HSplit_Main.Layout
end

to restore this:

Public Sub Settings_Load()
HSplit_Main.Layout = 
Settings["Your_Section_Name/HSplit_Main.Layout"] = HSplit_Main.Layout

End

BTW settings is located usually in:

/home/user/.config/gambas3/your_app_name.conf

eg /home/richard/ etc 

Regards

Richard

On Sunday 12 December 2010 12:15:27 Benoît Minisini wrote:
> > 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?
> 




More information about the User mailing list