OpenFileDialog

consoledoc.h

Derived from FileDialog, this class is responsible for opening a file browser with the intention of opening a file.

More...

Public Attributes

bool

True/False whether multiple files may be selected and returned or not.

bool

True/False whether the file returned must exist or not.

Detailed Description

Derived from FileDialog, this class is responsible for opening a file browser with the intention of opening a file.

The core usage of this dialog is to locate a file in the OS and return the path and name. This does not handle the actual file parsing or data manipulation. That functionality is left up to the FileObject class.

// Create a dialog dedicated to opening files
%openFileDlg = new OpenFileDialog()
{
   // Look for jpg image files
   // First part is the descriptor|second part is the extension
   Filters = "Jepg Files|*.jpg";
   // Allow browsing through other folders
   ChangePath = true;

   // Only allow opening of one file at a time
   MultipleFiles = false;
};

// Launch the open file dialog
%result = %openFileDlg.Execute();

// Obtain the chosen file name and path
if ( %result )
{
   %seletedFile = %openFileDlg.file;
}
else
{
   %selectedFile = "";
}

// Cleanup
%openFileDlg.delete();

note:

FileDialog and its related classes are only availble in a Tools build of Torque.

Public Attributes

bool MultipleFiles 

True/False whether multiple files may be selected and returned or not.

bool MustExist 

True/False whether the file returned must exist or not.