| Version: 3.1.5

Classes | Macros | Enumerations | Functions | Variables
filedlg.h File Reference

## Classes
class | wxFileDialog
| This class represents the file chooser dialog. More...

## Macros
#define | wxFD_DEFAULT_STYLE wxFD_OPEN

## Enumerations
enum | { wxFD_OPEN = 0x0001 , wxFD_SAVE = 0x0002 , wxFD_OVERWRITE_PROMPT = 0x0004 , wxFD_NO_FOLLOW = 0x0008 , wxFD_FILE_MUST_EXIST = 0x0010 , wxFD_CHANGE_DIR = 0x0080 , wxFD_PREVIEW = 0x0100 , wxFD_MULTIPLE = 0x0200 , wxFD_SHOW_HIDDEN = 0x0400 }

## Functions
wxString | wxFileSelector (const wxString &message, const wxString &default_path=wxEmptyString, const wxString &default_filename=wxEmptyString, const wxString &default_extension=wxEmptyString, const wxString &wildcard=wxFileSelectorDefaultWildcardStr, int flags=0, wxWindow *parent=NULL, int x=wxDefaultCoord, int y=wxDefaultCoord)
| Pops up a file selector box. More...
wxString | wxFileSelectorEx (const wxString &message=wxFileSelectorPromptStr, const wxString &default_path=wxEmptyString, const wxString &default_filename=wxEmptyString, int *indexDefaultExtension=NULL, const wxString &wildcard=wxFileSelectorDefaultWildcardStr, int flags=0, wxWindow *parent=NULL, int x=wxDefaultCoord, int y=wxDefaultCoord)
| An extended version of wxFileSelector() More...
wxString | wxLoadFileSelector (const wxString &what, const wxString &extension, const wxString &default_name=wxEmptyString, wxWindow *parent=NULL)
| Shows a file dialog asking the user for a file name for opening a file. More...
wxString | wxSaveFileSelector (const wxString &what, const wxString &extension, const wxString &default_name=wxEmptyString, wxWindow *parent=NULL)
| Shows a file dialog asking the user for a file name for saving a file. More...

## Variables
const char | wxFileSelectorDefaultWildcardStr []
| Default wildcard string used in wxFileDialog corresponding to all files. More...

## Macro Definition Documentation

## ◆ wxFD_DEFAULT_STYLE

#define wxFD_DEFAULT_STYLE wxFD_OPEN

## Enumeration Type Documentation

## ◆ anonymous enum

anonymous enum

Enumerator
wxFD_OPEN |
wxFD_SAVE |
wxFD_OVERWRITE_PROMPT |
wxFD_NO_FOLLOW |
wxFD_FILE_MUST_EXIST |
wxFD_CHANGE_DIR |
wxFD_PREVIEW |
wxFD_MULTIPLE |
wxFD_SHOW_HIDDEN |

## Function Documentation

## ◆ wxFileSelector()

wxString wxFileSelector | ( | const wxString & | message,
|  | const wxString & | default_path = `wxEmptyString`,
|  | const wxString & | default_filename = `wxEmptyString`,
|  | const wxString & | default_extension = `wxEmptyString`,
|  | const wxString & | wildcard = `wxFileSelectorDefaultWildcardStr`,
|  | int | flags = `0`,
|  | wxWindow * | parent = `NULL`,
|  | int | x = `wxDefaultCoord`,
|  | int | y = `wxDefaultCoord`
| ) |  |

Pops up a file selector box.

In Windows, this is the common file selector dialog. In X, this is a file selector box with the same functionality. The path and filename are distinct elements of a full file pathname. If path is empty, the current directory will be used. If filename is empty, 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. Flags may be a combination of wxFD_OPEN, wxFD_SAVE, wxFD_OVERWRITE_PROMPT or wxFD_FILE_MUST_EXIST.

Note
  wxFD_MULTIPLE can only be used with wxFileDialog and not here since this function only returns a single file name.

Both the Unix and Windows versions implement 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 files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif"

The application must check for an empty return value (the user pressed Cancel). For example:

wxString filename = wxFileSelector("Choose a file to open");
if ( !filename.empty() )
{
// work with the file
...
}
//else: cancelled by user
wxString
String class for passing textual data to or receiving it from wxWidgets.
Definition: string.h:315
wxString::empty
bool empty() const
An 'invalid' value for string index.
wxFileSelector
wxString wxFileSelector(const wxString &message, const wxString &default_path=wxEmptyString, const wxString &default_filename=wxEmptyString, const wxString &default_extension=wxEmptyString, const wxString &wildcard=wxFileSelectorDefaultWildcardStr, int flags=0, wxWindow *parent=NULL, int x=wxDefaultCoord, int y=wxDefaultCoord)
Pops up a file selector box.

Include file:

    #include <wx/filedlg.h>

## ◆ wxFileSelectorEx()

wxString wxFileSelectorEx | ( | const wxString & | message = `wxFileSelectorPromptStr`,
|  | const wxString & | default_path = `wxEmptyString`,
|  | const wxString & | default_filename = `wxEmptyString`,
|  | int * | indexDefaultExtension = `NULL`,
|  | const wxString & | wildcard = `wxFileSelectorDefaultWildcardStr`,
|  | int | flags = `0`,
|  | wxWindow * | parent = `NULL`,
|  | int | x = `wxDefaultCoord`,
|  | int | y = `wxDefaultCoord`
| ) |  |

An extended version of wxFileSelector()

Include file:

    #include <wx/filedlg.h>

## ◆ wxLoadFileSelector()

wxString wxLoadFileSelector | ( | const wxString & | what,
|  | const wxString & | extension,
|  | const wxString & | default_name = `wxEmptyString`,
|  | wxWindow * | parent = `NULL`
| ) |  |

Shows a file dialog asking the user for a file name for opening a file.

See also
  wxFileSelector(), wxFileDialog

Include file:

    #include <wx/filedlg.h>

## ◆ wxSaveFileSelector()

wxString wxSaveFileSelector | ( | const wxString & | what,
|  | const wxString & | extension,
|  | const wxString & | default_name = `wxEmptyString`,
|  | wxWindow * | parent = `NULL`
| ) |  |

Shows a file dialog asking the user for a file name for saving a file.

See also
  wxFileSelector(), wxFileDialog

Include file:

    #include <wx/filedlg.h>

## Variable Documentation

## ◆ wxFileSelectorDefaultWildcardStr

const char wxFileSelectorDefaultWildcardStr[]

Default wildcard string used in wxFileDialog corresponding to all files.

It is defined as "*.*" under MSW and "*" everywhere else.