FileDialog

Overview

Creates a new file dialog where a user can select a file to open or save.

Ancestors

  1. Control
  2. Container
 

Descendants

  1. None
 

See Also

  1. None

Constructors

new FileDialog
Description

Creates a new FileDialog window that is not shown by default.

Definition

new FileDialog(type)

Members

allowAnyFileType
Description

Gets or sets whether the use can select any file type.

Definition

boolean filedialog.allowAnyFileType
allowDirectories
Description

Gets or sets if the user is allowed to select a directory in addition to a file.

Definition

boolean filedialog.allowDirectories
allowFileTypes
Description

Gets or sets an array containing the file types (by extension) that are allowed.

Definition

array filedialog.allowFileTypes
allowMultiple
Description

Gets or sets whether selecting multiple files is allowed, if the file dialog is a save dialog type this value is ignored.

Definition

boolean filedialog.allowMultiple
directory
Description

Gets or sets the directory the file dialog is in.

Definition

string filedialog.directory
filename
Description

Gets or sets the filename the file dialog has (specified by the user).

Definition

string filedialog.filename
selection
Description

Gets the selection specified by the user once the dialog has been closed. The result is a URL or file path.

Definition

string filedialog.selection
title
Description

Gets or sets the title for the file dialog window.

Definition

string filedialog.title
type
Description

Gets the type of the file dialog (open or save). This is read only.

Definition

string filedialog.type

Methods

addEventListener(eventName, callback)
Description

Adds an event listener for various dialog level events. The first parameter is the name of the event, the second parameter is the function to call when the event happens (e.g., a callback).

Definition

filedialog.addEventListener(eventName, callback)
Parameters
NameTypeDescription
eventName string The name of the dialog event to start listening to.
callback function The function that will be called when it occurs.
open(window)
Description

Opens the file dialog window, if a window object is passed in the file dialog is placed on top of the passed in window preventing any user interaction with it. On OSX this causes a "sheet" effect, on Windows the file dialog is a modal window aligned with the passed in window. Note: Because of security and sandboxing on applications all event loops are paused until a selection is made by the user

Definition

filedialog.open(window)
Parameters
NameTypeDescription
window Window The window to associate with this file dialog.
removeEventListener(eventName, callback)
Description

Removes an event listener for various dialog level events. The first parameter is the name of the event, the second parameter is the function that was originally given as the callback for addEventListener.

Definition

filedialog.removeEventListener(eventName, callback)
Parameters
NameTypeDescription
eventName string The name of the dialog event to stop listening to.
callback function The function that would have been called.