Torque 3D - Script Manual: SaveFileDialog Class Reference

TorqueScript

Main   Class List   Namespace List   Online

SaveFileDialog Class Reference
[File I/O]

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

Inheritance diagram for SaveFileDialog:

List of all members.

Public Attributes

bool OverwritePrompt
 True/False whether the dialog should prompt before accepting an existing file name.

Detailed Description

Derived from FileDialog, this class is responsible for opening a file browser with the intention of saving 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 writing or data manipulation. That functionality is left up to the FileObject class.

Example:
 // Create a dialog dedicated to opening file
 %saveFileDlg = new SaveFileDialog()
 {
    // Only allow for saving of COLLADA files
    Filters        = "COLLADA Files (*.dae)|*.dae|";

    // Default save path to where the WorldEditor last saved
    DefaultPath    = $pref::WorldEditor::LastPath;

    // No default file specified
    DefaultFile    = "";

    // Do not allow the user to change to a new directory
    ChangePath     = false;

    // Prompt the user if they are going to overwrite an existing file
    OverwritePrompt   = true;
 };

 // Launch the save file dialog
 %saveFileDlg.Execute();

 if ( %result )
 {
    %seletedFile = %openFileDlg.file;
 }
 else
 {
    %selectedFile = "";
 }

 // Cleanup
 %saveFileDlg.delete();
Note:
FileDialog and its related classes are only availble in a Tools build of Torque.
See also:
FileDialog
OpenFileDialog
FileObject

Member Data Documentation

True/False whether the dialog should prompt before accepting an existing file name.



Copyright © GarageGames, LLC. All Rights Reserved.