[Gambas-user] Settings file - preserver comments
Bruce Steers
bsteers4 at gmail.com
Mon Feb 8 17:02:52 CET 2021
Top post:
On this subject (to original poster and Benoit)...
I can see advantages (and have wished it before) in being able to set the
Title of the settings file not just at creation but at anytime.
So I have submitted a modification to the Settings.class that will allow
this by simply making a Property called Title.
Then we would not have to create a mySettings object and could just use
Settings.Title. :)
Usefull if you think to add a comment after making many Settings[]
statements
Also a simple bit of code like the following would be good for a timestamp
(yes, i know i could just get the file modification date but there are
other uses, this is just an example)...
*Public Sub Form_Close() Settings.Title = "Settings last saved on " &
Str(Now)*
*End*
Note: the title only gets saved if there are any actual settings to save in
either case of new Property i submitted or normal method.
All the best
BruceS
On Mon, 8 Feb 2021 at 13:25, Bruce Steers <bsteers4 at gmail.com> wrote:
> you can set a comment line when calling Settings this way...
>
> *Dim mySettings As Settings*
> *mySettings = New Settings(Settings.Path, "My comment line here")*
>
> Then change all references to Settings["name"] to mySettings["Name")
>
> BruceS
>
>
> On Mon, 8 Feb 2021 at 07:42, pf <petterfilip at gmail.com> wrote:
>
>> Hi
>>
>>
>> I use a settings file but when i write to it the comments line made with
>> ; or # at the start of the line dissapears on update of any value.
>>
>> I would like to keep comments if the settings file is opened in a
>> texteditor so the user can get some tips on the values in the file.
>>
>>
>> Regards
>>
>> Chris
>>
>>
>> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210208/3c08b8de/attachment-0001.htm>
More information about the User
mailing list