Detailed Description

This class represents the file chooser dialog.

The path and filename are distinct elements of a full file pathname. If path is wxEmptyString, the current directory will be used. If filename is wxEmptyString, no default filename will be supplied. The wildcard determines what files are displayed in the file selector, and file extension supplies a type extension for the required filename.

All implementations of the wxFileDialog provide a wildcard filter. Typing a filename containing wildcards (*, ?) in the filename text item, and clicking on Ok, will result in only those files matching the pattern being displayed. The wildcard may be a specification for multiple types of file with a description for each, such as:

"BMP and GIF files (*.bmp;*.gif)|*.bmp;*.gif|PNG files (*.png)|*.png"

It must be noted that wildcard support in the native Motif file dialog is quite limited: only one file type is supported, and it is displayed without the descriptive test; "BMP files (*.bmp)|*.bmp" is displayed as "*.bmp", and both "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif" and "Image files|*.bmp;*.gif" are errors.

Styles

This class supports the following styles:

wxFD_DEFAULT_STYLE:

Equivalent to wxFD_OPEN.

wxFD_OPEN:

This is an open dialog; usually this means that the default button's label of the dialog is "Open". Cannot be combined with wxFD_SAVE.

wxFD_SAVE:

This is a save dialog; usually this means that the default button's label of the dialog is "Save". Cannot be combined with wxFD_OPEN.

wxFD_OVERWRITE_PROMPT:

For save dialog only: prompt for a confirmation if a file will be overwritten.

wxFD_FILE_MUST_EXIST:

For open dialog only: the user may only select files that actually exist. Notice that under OS X the file dialog with wxFD_OPEN style always behaves as if this style was specified, because it is impossible to choose a file that doesn't exist from a standard OS X file dialog.

wxFD_MULTIPLE:

For open dialog only: allows selecting multiple files.

wxFD_CHANGE_DIR:

Change the current working directory (when the dialog is dismissed) to the directory where the file(s) chosen by the user are.

wxFD_PREVIEW:

Show the preview of the selected files (currently only supported by wxGTK).

This virtual function is not meant to be called directly but can be overridden to return false (it returns true by default) to allow the application to close even if this, presumably not very important, window is still opened. More...

This method may be overridden in the derived classes to return false to indicate that while this control can, in principle, have focus if the user clicks it with the mouse, it shouldn't be included in the TAB traversal chain when using the keyboard. More...

This method calls SetSizer() and then wxSizer::SetSizeHints which sets the initial window size to the size needed to accommodate all sizer elements and sets the size hints which, if this window is a top level one, prevent the user from resizing it to be less than this minimal size. More...

Get the window border style from the given flags: this is different from simply doing flags & wxBORDER_MASK because it uses GetDefaultBorder() to translate wxBORDER_DEFAULT to something reasonable. More...

Get the window border style from the given flags: this is different from simply doing flags & wxBORDER_MASK because it uses GetDefaultBorder() to translate wxBORDER_DEFAULT to something reasonable. More...

Get the window border style from the given flags: this is different from simply doing flags & wxBORDER_MASK because it uses GetDefaultBorder() to translate wxBORDER_DEFAULT to something reasonable. More...

This function is (or should be, in case of custom controls) called during window creation to intelligently set up the window visual attributes, that is the font and the foreground and background colours. More...

Returns true if the window contents is double-buffered by the system, i.e. if any drawing done on the window is really done on a temporary backing surface and transferred to the screen all at once later. More...

This virtual function is normally only used internally, but sometimes an application may need it to implement functionality that should not be disabled by an application defining an OnIdle handler in a derived class. More...

Processes the pending events previously queued using QueueEvent() or AddPendingEvent(); you must call this function only if you are sure there are pending events for this handler, otherwise a wxCHECK will fail. More...

Unbinds the given function, functor or method dynamically from the event handler, using the specified parameters as search criteria and returning true if a matching function has been found and removed. More...

Member Function Documentation

Notice that this file is not necessarily going to be accepted by the user, so calling this function mostly makes sense from an update UI event handler of a custom file dialog extra control to update its state depending on the currently selected file.

Currently this function is fully implemented under GTK and MSW and always returns an empty string elsewhere.

Since

2.9.5

Returns

The path of the currently selected file or an empty string if nothing is selected.

This function should only be used with the dialogs which have wxFD_MULTIPLE style, use GetFilename() for the others.

Note that under Windows, if the user selects shortcuts, the filenames include paths, since the application cannot determine the full path of each referenced file by appending the directory containing the shortcuts to the filename.

virtual int wxFileDialog::GetFilterIndex

(

)

const

virtual

Returns the index into the list of filters supplied, optionally, in the wildcard parameter.

Before the dialog is shown, this is the index which will be used when the dialog is first displayed.