Dialog for selecting files or directories in the filesystem.
    public class FileDialog : ConfirmationDialog

FileDialog is a preset dialog used to choose files and directories in the filesystem. It supports filter masks.

Inheritance Chain

Constructors

    public FileDialog()

Signals

    "dir_selected" (String dir)

Event emitted when the user selects a directory.

    "file_selected" (String path)

Event emitted when the user selects a file (double clicks it or presses the OK button).

    "files_selected" (PoolStringArray paths)

Event emitted when the user selects multiple files.

Properties

    public AccessEnum Access { get; set; }

    public string CurrentDir { get; set; }

The current working directory of the file dialog.

    public string CurrentFile { get; set; }

The currently selected file of the file dialog.

    public string CurrentPath { get; set; }

The currently selected file path of the file dialog.

    public string[] Filters { get; set; }

    public ModeEnum Mode { get; set; }

    public bool ModeOverridesTitle { get; set; }

If true, changing the mode property will set the window title accordingly (e. g. setting mode to MODE_OPEN_FILE will change the window title to “Open a File”).

    public bool ShowHiddenFiles { get; set; }

Methods

    public void AddFilter(string filter)

Add a custom filter. Filter format is: “mask ; description”, example (C++): dialog->add_filter(“*.png ; PNG Images”);

    public void ClearFilters()

Clear all the added filters in the dialog.

    public void DeselectItems()

    public AccessEnum GetAccess()

Getter for Access

    public string GetCurrentDir()

Getter for CurrentDir

    public string GetCurrentFile()

Getter for CurrentFile

    public string GetCurrentPath()

Getter for CurrentPath

    public string[] GetFilters()

Getter for Filters

    public ModeEnum GetMode()

Getter for Mode

    public VBoxContainer GetVbox()

Return the vertical box container of the dialog, custom controls can be added to it.

    public void Invalidate()

Invalidate and update the current dialog content list.

    public bool IsModeOverridingTitle()

Getter for ModeOverridesTitle

    public bool IsShowingHiddenFiles()

Getter for ShowHiddenFiles

    public void SetAccess(AccessEnum access)

Setter for Access

    public void SetCurrentDir(string dir)

Setter for CurrentDir

    public void SetCurrentFile(string file)

Setter for CurrentFile

    public void SetCurrentPath(string path)

Setter for CurrentPath

    public void SetFilters(string[] filters)

Setter for Filters

    public void SetMode(ModeEnum mode)

Setter for Mode

    public void SetModeOverridesTitle(bool @override)

Setter for ModeOverridesTitle

    public void SetShowHiddenFiles(bool show)

Setter for ShowHiddenFiles

Inner Types

AccessEnum

Name Value Description
Resources 0 The dialog allows the selection of file and directory.
Userdata 1 The dialog allows access files under [Resource] path(res://) .
Filesystem 2 The dialog allows access files in whole file system.

ModeEnum

Name Value Description
OpenFile 0 The dialog allows the selection of one, and only one file.
OpenFiles 1 The dialog allows the selection of multiple files.
OpenDir 2 The dialog functions as a folder selector, disallowing the selection of any file.
OpenAny 3 The dialog allows the selection of a file or a directory.
SaveFile 4 The dialog will warn when a file exists.
Tags: