class fileDialog

superclass(es) object
subclass(es) fileOpenDialog - fileSaveDialog
description The fileDialog class is the abstract base class for all kinds of file dialogs like a "File Open" and "File Save" dialogs.
see also textFileOpenDialog

tasks

The fileDialog class has methods for setting the file name and initial folder of the file dialog. There is also a method for adding file filters to a dialog, a file filter is used to select only a subset of files from a folder, an example of a file filter is *.txt, a file dialog instance can contain multiple file filters. The class textFileOpenDialog is a "File Open" dialog that has two file filters; a '*.*' and a '*.txt' filter.
Determining which file filter the user has chosen is done with the method fileFilter/1.

There are two methods for adding standard file filters to a dialog, they are: addFileFilterTextFiles/1 and addFileFilterAllFiles/1.

methods

initialFolder(Output)

func Retrieve the initial folder that will be shown when a file dialog is opened.
pre TRUE.
post The Output variable is assigned the name of the initial folder, if there is no initial folder then no value is assigned to Output.

putInitialFolder(String)

func Set the initial folder of a file dialog. The contents of this folder will be shown when the dialog is opened.
pre String must contain the name of a folder.
post The initial folder has been set to the value of String.

fileName(Output)

func Get the complete name of the file choosen, if the dialog was closed by pressing on the "OK" button.
pre TRUE.
post The file choosen is assigned to Output.

putFileName(String)

func Set the file that was choosen.
pre String must contain the name of a file.
post The value of String is now considered the current file choosen.

title(Output)

func Get the title of the dialog.
pre TRUE.
post The title of the dialog was assigned to Output.

putTitle(String)

func Set the title of the dialog, this title will override the default dialog title.
pre String must contain a string value.
post The next time the dialog is shown it's title will be equal to the value of String.

defaultExtension(Output)

func Get the default extension of the file dialog, this is the extension that is appended to a file name when it contains no extension..
pre TRUE.
post The default extension was assigned to the varaible Output.

putDefaultExtension(String)

func Set the default extension of the file dialog, this is the extension that will be appended to a filename if a file name contains no extension.
pre The String variable must contain text.
post The value of String has become the default extension of the file dialog.

addFileFilter(Name, Filter, Default)

func Add a file filter to a dialog, a file filter is used to select a subset of all files in a folder. The name of the file filter is visible in the dialog and the associated Filter is used to select files, if Default is true the file filter will be the default file filter.
pre The Name and Filter variables must contain text and Default must contain true or false.
post The file filter was added to the file dialog.

fileFilter(FilterIndex)

func Determine which filter the user has chosen after the dialog was closed. The index of the first filter is 1, etc.
pre TRUE
post The index of the file filter was unified with the argument FilterIndex.

addFileFilterTextFiles(Default)

func Add a file filter for text files to the dialog, the file filter is used to select only files with the 'txt' extension of all files in a folder. If Default is true the file filter will be the default file filter.
pre The Default variable must contain true or false.
post The file filter for text files was added to the file dialog.

addFileFilterAllFiles(Default)

func Add a file filter for all files to the dialog, the file filter is used to select all files in a folder. If Default is true the file filter will be the default file filter.
pre The Default variable must contain true or false.
post The file filter for all files was added to the file dialog.