Selecting multiple files with TGFileDialog

Hi,

is it possible to load/select more than 1 file with TGFileDialog?

For e.g. I have the following code:

static TString dir(“C:\Somewhere\folder”);
TGFileInfo fi;
fi.fFileTypes = filetypesin;
fi.fIniDir = StrDup(dir);
new TGFileDialog(gClient->GetRoot(), fMainFrame4024, kFDOpen, &fi);
printf(“Open file: %s (dir: %s)\n”, fi.fFilename, fi.fIniDir);
dir = fi.fIniDir;
char * filename = fi.fFilename;

Is there a way to select more than 1 file and to end up with something like a char ** filename array?

Thanx,
Balint

Hi Balint,

When the check button ‘Multiple files’ is selected in Open File dialog, the multiple ROOT file selection is allowed in the file list of the current directory. The files can be selected in a usual way: by pressing the Shift key and defining the range of files, or by pressing the Ctrl key and selecting different files. This new feature can be used following way:TGFileInfo fi; new TGFileDialog(fClient->GetDefaultRoot(), this, kFDOpen,&fi); if (fi.fMultipleSelection && fi.fFileNamesList) { TObjString *el; TIter next(fi.fFileNamesList); while ((el = (TObjString *) next())) { new TFile(el->GetString(), "update"); } } else if (fi.fFilename) { new TFile(fi.fFilename, "update"); }Cheers, Ilka

Hi Ilka,

Great! Thanks! :smiley:

Cheers,
Balint

Hi Balint,

You are welcome. Just forgot to mention that this feature was implemented last summer and is available in the dveloper releases of ROOT after August 2006; also in the production release v5.14.

Best regards, Ilka

Hi Ilka,

yeah I am currently using 5.12 and I obviously couldn’t find this new feature in the OpenFile dialog, but either way,it is time to move to a newer version.

Thanx,

Balint