[Gambas-user] How Settings.Read works?

Benoit Minisini benoit.minisini at gambas-basic.org
Thu Sep 29 13:19:25 CEST 2022


Le 29/09/2022 à 12:29, gian via User a écrit :
> Hi,
> 
> the issue is simple: either I have not understood how Settings.Read 
> works, or Settings.Read does not work completely.
> 
> [code]
> 
> Public Sub Form_Open()
> 
>    ' If Settings.Exist("FMain/Geometry") Then ' <------------------this 
> works
>    '   Settings.Read(Me)
>    ' Else
>    '   Me.X = 100
>    '   Me.Y = 100
>    ' Endif
>    Settings.Read(Me, "Geometry", [100, 100, 512, 512, 0, 0]) ' <---this 
> *not* works, also with key "FMain/Geometry" or nothing key
> 
> End
> 
> Public Sub Form_Close()
> 
>    Settings.Write(Me)
> 
> End
> 
> [/code]
> 
> Regards & Thanks
> 
> Gianluigi
> 
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----

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,

-- 
Benoît Minisini.



More information about the User mailing list