Main   Class List   Namespace List   Wiki

OpenFileDialog Class Reference
[File I/O]

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

Inheritance diagram for OpenFileDialog:
Inheritance graph
[legend]

List of all members.

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.

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.

Example:
 // 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.
See also:
FileDialog
SaveFileDialog
FileObject

Member Data Documentation

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

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



Copyright © GarageGames, LLC. All Rights Reserved.