FileDialog
This object represents a window allowing the user to choose a file.
Functions
FileDialog
Syntax
var myObject = new FileDialog();
var myObject = new FileDialog(parameters);
Arguments
parameters - (object) window parameters
title - (string) the window's title
position - (
Point) the window's position
opacity - (float) the window's opacity
enabled - (boolean) the window's enabled status
visible - (boolean) the window's visible status
-
-
-
selectedFile - (string) the default selected file
selectedNameFilter - (string) the default selected name filter
defaultSuffix - (string) the default file suffix
directory - (string) the default directory
-
nameFilter - (string) the name filter
nameFilters - (array) an array of name filters to use
showDirectoriesOnly - (boolean) show directories only
dontResolveSymlinks - (boolean) do not resolve symbolic links (Linux only)
dontConfirmOverwrite - (boolean) do not confirm overwrite
dontUseNativeDialog - (boolean) do not use the native dialog
readOnly - (boolean) show read-only files (Windows only)
hideNameFilterDetails - (boolean) hide the name filter details
sidebarUrls - (array) an array of urls shown on the side bar
onClosed - (
OnClosed event called when the window is closed
onCurrentChanged - (
OnCurrentChanged event called when the current selection changed
-
onFileSelected - (
OnFileSelected event called when the window is closed
-
-
Exceptions
Example
var myObject = new FileDialog();
var myObject = new FileDialog({
title: "Select a file",
acceptMode: FileDialog.Open
});
Methods
setTitle
Syntax
myObject.setTitle(title);
Arguments
title - (string) the window's title
Returns
setPosition
Sets the window's position.
Syntax
myObject.setPosition(point);
Arguments
point - (
Point) the window's position
Returns
setOpacity
Sets the window's opacity.
Syntax
myObject.setOpacity(opacity);
Arguments
opacity - (float) the window's opacity
Returns
setEnabled
Sets the window's enabled status.
Syntax
myObject.setEnabled(enabled);
Arguments
enabled - (boolean) the window's enabled status
Returns
setVisible
Sets the window's visible status.
Syntax
myObject.setVisible(visible);
Arguments
visible - (boolean) the window's visible status
Returns
close
Syntax
Returns
title
Returns the window's title.
Syntax
Returns
position
Returns the window's position.
Syntax
Returns
(
Point) the window's position
opacity
Returns the window's opacity.
Syntax
Returns
enabled
Returns the window's enabled status.
Syntax
Returns
visible
Returns the window's visible status.
Syntax
Returns
setAcceptMode
Syntax
myObject.setAcceptMode(acceptMode);
Arguments
Returns
setFileMode
Syntax
myObject.setFileMode(fileMode);
Arguments
Returns
setViewMode
Syntax
myObject.setViewMode(viewMode);
Arguments
Returns
setLabelText
Syntax
myObject.setLabelText(dialogLabel, text);
Arguments
-
text - (string) the label text
Returns
selectFile
Syntax
myObject.selectFile(filename);
Arguments
filename - (string) the file to select
Returns
selectNameFilter
Syntax
myObject.selectNameFilter(filter);
Arguments
filter - (string) the name filter
Returns
setDefaultSuffix
Selects the default suffix.
Syntax
myObject.setDefaultSuffix(defaultSuffix);
Arguments
defaultSuffix - (string) the default suffix
Returns
setDirectory
Selects the current directory.
Syntax
myObject.setDirectory(directory);
Arguments
directory - (string) the current directory
Returns
setFilter
Syntax
myObject.setFilter(filters);
Arguments
filters - (
Filters) the filters to use
Returns
setNameFilter
Syntax
myObject.setNameFilter(nameFilter);
Arguments
nameFilter - (string) the name filter
Returns
setNameFilters
Syntax
myObject.setNameFilters(nameFilters);
Arguments
nameFilters - (array) an array of name filters to use
Returns
setShowDirectoriesOnly
Should the window show directories.
Syntax
myObject.setShowDirectoriesOnly(showDirectoriesOnly);
Arguments
showDirectoriesOnly - (boolean) show directories only
Returns
setDontResolveSymlinks
Should the window resolve symbolic links.
Syntax
myObject.setDontResolveSymlinks(dontResolveSymlinks);
Arguments
dontResolveSymlinks - (boolean) resolve symbolic links
Returns
setDontConfirmOverwrite
Should the window ask for confirmation when overwriting a file.
Syntax
myObject.setDontConfirmOverwrite(dontConfirmOverwrite);
Arguments
dontConfirmOverwrite - (boolean) ask for confirmation when overwriting a file
Returns
setDontUseNativeDialog
Should the window use native a dialog.
Syntax
myObject.setDontUseNativeDialog(dontUseNativeDialog);
Arguments
dontUseNativeDialog - (boolean) use native a dialog
Returns
setReadOnly
Should the window show readonly files.
Syntax
myObject.setReadOnly(readOnly);
Arguments
readOnly - (boolean) show readonly files
Returns
setHideNameFilterDetails
Hide name filter details.
Syntax
myObject.setHideNameFilterDetails(hideNameFilterDetails);
Arguments
hideNameFilterDetails - (boolean) hide name filter details
Returns
Syntax
myObject.setSidebarUrls(sidebarUrls);
Arguments
sidebarUrls - (array) the sidebar urls
Returns
selectedFile
Returns the selected file.
Syntax
Returns
selectedFiles
Returns the selected files.
Syntax
myObject.selectedFiles();
Returns
selectedNameFilter
Syntax
myObject.selectedNameFilter();
Returns
selectedNameFilter
Syntax
myObject.selectedNameFilter();
Returns
show
Show the window. (non-blocking)
Use the OnClosed event to know when the window has been closed.
Syntax
Returns
showModal
Show the window. (blocking)
Syntax
Returns
Events
onClosed
Called when the window is closed.
Syntax
myObject.onClosed = function(result) {};
Arguments
result - (integer) the window result (0 means that it has been canceled)
Example
myObject.onClosed = function(result)
{
if(result)
{
//Event action
}
};
onCurrentChanged
Called when the current file has changed.
Syntax
myObject.onCurrentChanged = function(path) {};
Arguments
path - (string) the current file
Example
myObject.onCurrentChanged = function(path)
{
//Event action
};
onDirectoryEntered
Called when the current directory has changed.
Syntax
myObject.onDirectoryEntered = function(directory) {};
Arguments
directory - (string) the current file
Example
myObject.onDirectoryEntered = function(directory)
{
//Event action
};
onFileSelected
Called when the dialog is accepted.
Syntax
myObject.onFileSelected = function(file) {};
Arguments
file - (string) the selected file
Example
myObject.onFileSelected = function(file)
{
//Event action
};
onFilesSelected
Called when the dialog is accepted.
Syntax
myObject.onFilesSelected = function(files) {};
Arguments
files - (array) the selected files, as an array containing filenames
Example
myObject.onFilesSelected = function(files)
{
//Event action
};
onFilterSelected
Called when the filter is changed.
Syntax
myObject.onFilterSelected = function(filter) {};
Arguments
filter - (string) the new filter
Example
myObject.onFilterSelected = function(filter)
{
//Event action
};
Attributes
title
The window's title. (string)
position
The window's position. (Point)
opacity
The window's opacity. (float)
enabled
The window's enabled status. (boolean)
visible
The window's visible status. (boolean)
Enumerations
AcceptMode
Sets the accept mode of the window.
Values
Open: the dialog is used to open a file
Save: the dialog is used to save to a file
FileMode
Sets the file mode of the window.
Values
AnyFile: the selected file has not to exist to be selected
ExistingFile: there is only one file that can be selected and it has to exist
ExistingFiles: zero or more existing file can be selected
Directory: a directory can be selected
ViewMode
Sets the view mode of the window.
Values
Detail: show files with details
List: show only the file name and icon
DialogLabel
The label of the window to edit.
Values
LookIn: the "look in" label
FileName: the filename label
FileType: the filetype label
Accept: the accept label
Reject: the reject label
Filters
Values
Dirs: list directories
AllDirs: list all directories without applying filters to directory names
Files: list files
Drives: list drives (Windows only)
NoSymLinks: do not list symbolic links (Linux only)
NoDotAndDotDot: do not list the special entries . and ..
NoDot: do not list the special entry .
NoDotDot: do not list the special entry ..
AllEntries: list directories, files and drives (same as Dirs | Files | Drives)
Readable: list readable files
Writable: list writable files
Executable: list executable files
Modified: list modified files (Windows only)
Hidden: list hidden files (on Linux, files starting with a dot)
System: list system files
CaseSensitive: the filter string should be case sensitive
Notes
This is a flag enumeration, this means that you can use multiple values using the | operator.
Example :
myObject.setFilter(FileDialog.Files | FileDialog.Executable); //List only files that are executable