[Gambas-user] Private settings file question
Bruce Steers
bsteers4 at gmail.com
Sun Dec 6 14:59:27 CET 2020
Well if you just want to write the setting then yes.
I was just adapting the code you wrote.
The example you posted wrote nothing but you wanted the data written to
file.
*varTest01 = confFile["UserPreferences/ImageFilesPath", strImageFilesPath]*
That attempts to find and read the setting, if not there is uses the
default you supplied.
That's what you would use at program start to get the setting.
*confFile["UserPreferences/ImageFilesPath"] = varTest01*
That writes the setting, you would use this at any setting change.
*confFile.Save*
No real need to use that unless you want the settings file on disk to be
updated instantly during program run as all setting changes are saved to
disk at program close.
Clever stuff.
On Sun, 6 Dec 2020 at 08:27, KKing <kicking177 at gmail.com> wrote:
> thank you, that works even if I don't find it intuitive
>
> to me something like
>
> confFile["UserPreferences/ImageFilesPath"] = strImageFilesPath
>
> would make more sense than
>
> varTest01 = confFile["UserPreferences/ImageFilesPath",
> strImageFilesPath]
> confFile["UserPreferences/ImageFilesPath"] = varTest01
>
> but obviously not.
>
> > You example does not "Write" any settings, it only tries to read them.
> >
> > Try...
> > varTest01 = confFile["UserPreferences/ImageFilesPath", strImageFilesPath]
> > confFile["UserPreferences/ImageFilesPath"] = varTest01
> > confFile.Save
>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20201206/66e0ee76/attachment.htm>
More information about the User
mailing list