[Gambas-user] Write-Read from text file

Benoit Minisini gambas at ...1...
Tue Jun 27 20:57:50 CEST 2006


On Tuesday 27 June 2006 09:45, Eilert wrote:
> >
> > Salut,
> >
> > With settings component Gambas create automaticaly a new file whose name
> > is your program name with the .conf extension locate in
> > /home/user/.gambas for gambas1
> > to update it see example below.
> > Type = "mysql"
> > Name = "test"
> > Login = "user"
> > Password = "123456"
> > Version = "1.00"
> > Settings["/dbase/Type"] = Type
> > Settings["/dbase/Name"] = Name
> > Settings["/dbase/Login"] = login.
> > Settings["/dbase/Password"] = Password
> > Settings["/Version"] = Version
> >
> > to read it
> > Type = Settings["/dbase/Type"]
> > Name = Settings["/dbase/Name"]
> > Login = Settings["/dbase/Login"]
> > Password = Settings["/dbase/Password"]
> > Version = Settings["/Version"]
>
> Ah, ok, but is it possible to take any influence on the place and name
> of the file? And is it possible to manage several files?
>
> And I'm missing .Read and .Write in your example. Not necessary?
>
> Rolf
>

Yes.

Settings is an "auto-creatable" class, whose default instance use 
"~/.config/gambas/<myproject>.conf" file (in the development version).

But you can create your own settings file by instanciating the class this way:

MySettings = NEW Settings("/path/to/my/conf/file")

The Read() and Write() is used for reading and writing settings of some 
objects in a standard way: at the moment, only windows and splitter 
coordinates.

You have more information in the gambas wiki.

Regards,

-- 
Benoit Minisini




More information about the User mailing list