[Gambas-user] How Settings.Read works?

Benoit Minisini benoit.minisini at gambas-basic.org
Thu Sep 29 15:48:40 CEST 2022


Le 29/09/2022 à 15:29, bb a écrit :
>>
>> 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.
> 
> sample:
> 
> gvwCard.Font="Liberation Sans,8"
> 
> gvwCard.SortOrder=[0,""]
> 
> gvwCard=[32,57,385,42,201,64,40,32,37,77,83,69,30,30,64]
> 
> 
> 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).

Alas GridView has no Settings property, so nothing is saved.

> 
> 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 
> Settings.Write)
> is the settings that are saved *determinate* somehow? I have never been 
> able to satisfactorally resolve this.

If you have several instances of the same form, you must use a different 
'Key' argument for each one in the Settings.Write() method.

Regards,

-- 
Benoît Minisini.



More information about the User mailing list