[Gambas-user] How Settings.Read works?

bb adamnt42 at gmail.com
Thu Sep 29 15:29:37 CEST 2022

On Thu, 2022-09-29 at 15:04 +0200, Benoit Minisini wrote:
> Le 29/09/2022 à 15:01, bb a écrit :
> > On Thu, 2022-09-29 at 13:19 +0200, Benoit Minisini wrote:
> > > 
> > > Settings class has special support for windows (and controls
> > > having a
> > > Settings property).
> > > 
> > > So, for windows, you just have to write 'Settings.Write(Me)' to
> > > save its
> > > geometry, and 'Settings.Read(Me)' to restore it.
> > > 
> > > You can't use the default value argument in that case, as you
> > > can't
> > > guess the format used for storing the window data.
> > > 
> > > Regards,
> > > 
> > Maybe I have misunderstood this for years. I thought that the
> > property 
> > involved was the
> > Layout property. I have used that property in many custom grid
> > controls 
> > to save and
> > restore the user's choice of column widths.
> > Can I save more than just the layout by creating a more complex
> > Settings 
> > property (and if so, how?)
> > 
> > b
> > 
> The settings is not necessarily just the layout.
OK but what is it?
Given the following stored in the user's config file for a program,
just what is saved and restored using Settings.Write and .Read? This is
quite confusing.

gvwCard.Font="Liberation Sans,8"

An example of what I am not seeing is if the user sorts the grid using
say column 3 descending, I don't see that saved in the config file
after a Settings.Write(gvwCard).

And by the way, just to make this a little bit harder. Consider a main
form that has an arbitrary number of other form controls homed in a set
of tabs, each "embedded" form being an
instance of one form class. I'll try and make this clearer.  fMain has
a tabstrip where the number of tabs is set dynamically. Each tab
contains an instance of fEvent. The tabs are created
at startup with its Count set to the number of events happening today.
For each tab an instance of fEvent is created and parented in the
respective tab.
Now, it is possible that the user adjusts the column widths and sort
orders or even the font for the grid in each tab differently.  So, when
the main form is closed (and closes each fEvent which issues a
is the settings that are saved determinate somehow? I have never been
able to satisfactorally resolve this.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20220929/1a444d80/attachment.htm>

More information about the User mailing list