Re: TGFileDialog

Fons Rademakers (Fons.Rademakers@cern.ch)
Fri, 24 Apr 1998 11:12:42 +0200


Hi Carlos,

fIniDir is currenlty not used. The file dialog will always start
with the contents of the current directory. In the file dialog you
can change the current directory. The returned filename is relative
to the current directory. You can get and set easily the working
directory using:
gSystem->WorkingDirectory()
gSystem->ChangeDirectory(path)
so when the file dialog returns just call the WorkingDirectory() method
which returns the current directory.

Cheers, Fons.

Carlos Lacasta wrote:
>
> Hi,
>
> Is there a way of getting the directory name of a file selected with
> TGFileDialog ?
>
> If I do
>
>
> TGFileInfo fi;
> fi.fFileTypes = (char **)filetypes;
> fi.fIniDir = szDir;
> *fi.fIniDir = 0;
> new TGFileDialog(fClient->GetRoot(), this, kFDOpen,&fi);
> cout << fi.fFilename << endl
> << fi.fIniDir << endl;
>
> I get the file base name in fi.fFilename and fi.fIniDir is still empty.
> I guess that fIniDir defines the initial directory, although I could not find
> it in the source file available in the WWW.
>
> Thanks in advance,
>
> Carlos
>
> ___________________________________________________________________
> Carlos Lacasta
> ^^^^^^^^^^^^^^^
> Division PPE
> Bat. 161 1-014
> CERN
> CH 1211 Meyrin/Geneve
> Switzerland/Suisse
> Tel.: +41 22 7673028
> Fax.: +41 22 7677150
> WWW : http://wwwcn.cern.ch/~lacasta
> ___________________________________________________________________

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland          Phone: +41 22 7679248
E-Mail: Fons.Rademakers@cern.ch              Fax:   +41 22 7677910