FileDialog

    Category: Core

    Dialog for selecting files or directories in the filesystem.

    Properties

    Methods

    void ( String filter )
    void ( )
    voiddeselect_items ( )
    get_line_edit ( )
    get_vbox ( )
    void ( )
    Colorfiles_disabled
    folder
    Textureparent_folder
    reload

    Signals

    Event emitted when the user selects a directory.


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


    • files_selected ( paths )

    Event emitted when the user selects multiple files.

    Enumerations

    enum Mode:

    • MODE_OPEN_FILE = 0 — The dialog allows the selection of one, and only one file.
    • MODE_OPEN_FILES = 1 — The dialog allows the selection of multiple files.
    • MODE_OPEN_DIR = 2 — The dialog functions as a folder selector, disallowing the selection of any file.
    • MODE_OPEN_ANY = 3 — The dialog allows the selection of a file or a directory.
    • MODE_SAVE_FILE = 4 — The dialog will warn when a file exists.

    • ACCESS_RESOURCES = 0 — The dialog allows the selection of file and directory.
    • ACCESS_USERDATA = 1 — The dialog allows access files under Resource path() .
    • ACCESS_FILESYSTEM = 2 — The dialog allows access files in whole file system.

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

    Property Descriptions

    The file system access scope. See enum constants.


    Setterset_current_dir(value)
    Getterget_current_dir()

    The current working directory of the file dialog.


    • current_file
    Setterset_current_file(value)
    Getterget_current_file()

    The currently selected file of the file dialog.


    The currently selected file path of the file dialog.


    • filters
    Setterset_filters(value)
    Getterget_filters()

    Set file type filters. This example shows only .png and .gd files set_filters(PoolStringArray(["*.png ; PNG Images","*.gd ; GD Script"])).


    Setterset_mode(value)
    Getterget_mode()

    • mode_overrides_title

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


    • show_hidden_files
    Setterset_show_hidden_files(value)
    Getteris_showing_hidden_files()

    If true, the dialog will show hidden files.

    Method Descriptions

    • void add_filter ( String filter )

    Add a custom filter. Example:


    • void clear_filters ( )

    Clear all the added filters in the dialog.


    • void deselect_items ( )

    Clear currently selected items in the dialog.


    • get_line_edit ( )

    Returns the LineEdit for the selected file.



    • void invalidate ( )

    Invalidate and update the current dialog content list.