File dialogs

A file dialog is a special class. It shows up in a View window and gives the result of user interaction in a callback. It is not a class that instantiates a reusable object. It is used in a disposable way.


File dialog does not have any methods.

Constructor flags

  • triggerFunction – a callback function that will receive the result of the file dialog. This might be false, or an array of fileinfo objects.
  • path – a Friend path. Mountlist: can be given if you just want to show the list of available disk volumes.
  • type – load or open for loading files, save for saving a file, and path for just selecting a path
  • title – the view window title for the file dialog
  • filename – optional – if it is a save dialog, then you can preset what the proposed save filename should be
  • multiSelect – optional – whether to allow multiple file selections or not (for opening files only). Boolean parameter; true or false
  • mainView – optional – a file dialog can block a parent view window, so that you can not access it before a selection has been made. The value must be a valid viewId, which you will get from any view object or Application contained inside a view.
  • suffix – optional – either a string or an array of filename suffixes to filter on


Opening a file dialog for loading selected files:

var flags = {
    triggerFunction: function( items )
         console.log( "These files and directories were selected:", items );
    path: "Mountlist:",
    type: "load",
    title: "My file dialog",
    filename: "",
    multiSelect: true,
    mainView: Application.viewId,
    suffix: [ 'html', 'htm' ]

// Open the file dialog view window
var d = new Filedialog( flags );

As you can see, the file dialog takes a description object in the constructor. The dialog immediately appears. The object that is returned is irrelevant, and can be disposed of.

Was this page helpful?