Page 1 of 1

Using Settings File

Posted: Monday 19th August 2019 4:14pm
by Cedron
This is forwarded from:

https://forum.gambas.one/viewtopic.php? ... 5&start=20

(New topics deserve new threads.)
Lavos wrote: Monday 19th August 2019 7:35am So I looked into this: http://gambaswiki.org/wiki/comp/gb.settings/settings and this seems like it could only handle form Objects... It's probably obvious for you guys where I'm trying to achieve here(Creating a database for the application to access files when needed.) So starting off, I'm trying to figure out how to create a .ini or .conf file to preset options to save for the user. Perfect reference is getprivateProfileString from windows if that makes any sense to you. I've never worked with XML before but it seems like it might be an alternative, any code examples of that would help.

I'm on a windows machine when i posted this, so any request of posting codes, i'd be happy too when i get to my linux machine.

-Regards, Lavos
I'm not sure where you got the impression that Settings could only handle form Objects. It deals in strings. The format of the files are very similar, if not identical, to .ini files in Windows. And the calls to retrieve the values are also similar.

By default, you will find the .conf file in your ~/.config/gambas3 directory.

You can find a usage example from this thread:

https://forum.gambas.one/viewtopic.php?f=4&t=720

Download the copy from the last post.

Ced

Re: Using Settings File

Posted: Monday 19th August 2019 4:40pm
by cogier
I wrote a simple program to show how to use settings here if it helps.