#include <wx/filepicker.h>
This control allows the user to select a file.
The generic implementation is a button which brings up a wxFileDialog when clicked. Native implementation may differ but this is usually a (small) widget which give access to the file-chooser dialog. It is only available if wxUSE_FILEPICKERCTRL
is set to 1 (the default).
This class supports the following styles:
The following event handler macros redirect the events to member function handlers 'func' with prototypes like:
Event macros for events emitted by this class:
![]() | ![]() | ![]() |
wxMSW appearance | wxGTK appearance | wxMac appearance |
Public Member Functions | |
wxFilePickerCtrl (wxWindow *parent, wxWindowID id, const wxString &path=wxEmptyString, const wxString &message=wxFileSelectorPromptStr, const wxString &wildcard=wxFileSelectorDefaultWildcardStr, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxFLP_DEFAULT_STYLE, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxFilePickerCtrlNameStr) | |
Initializes the object and calls Create() with all the parameters. | |
bool | Create (wxWindow *parent, wxWindowID id, const wxString &path=wxEmptyString, const wxString &message=wxFileSelectorPromptStr, const wxString &wildcard=wxFileSelectorDefaultWildcardStr, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxFLP_DEFAULT_STYLE, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxFilePickerCtrlNameStr) |
Creates this widget with the given parameters. | |
wxFileName | GetFileName () const |
Similar to GetPath() but returns the path of the currently selected file as a wxFileName object. | |
wxString | GetPath () const |
Returns the absolute path of the currently selected file. | |
void | SetFileName (const wxFileName &filename) |
This method does the same thing as SetPath() but takes a wxFileName object instead of a string. | |
void | SetPath (const wxString &filename) |
Sets the absolute path of the currently selected file. |
wxFilePickerCtrl::wxFilePickerCtrl | ( | wxWindow * | parent, | |
wxWindowID | id, | |||
const wxString & | path = wxEmptyString , |
|||
const wxString & | message = wxFileSelectorPromptStr , |
|||
const wxString & | wildcard = wxFileSelectorDefaultWildcardStr , |
|||
const wxPoint & | pos = wxDefaultPosition , |
|||
const wxSize & | size = wxDefaultSize , |
|||
long | style = wxFLP_DEFAULT_STYLE , |
|||
const wxValidator & | validator = wxDefaultValidator , |
|||
const wxString & | name = wxFilePickerCtrlNameStr | |||
) |
Initializes the object and calls Create() with all the parameters.
bool wxFilePickerCtrl::Create | ( | wxWindow * | parent, | |
wxWindowID | id, | |||
const wxString & | path = wxEmptyString , |
|||
const wxString & | message = wxFileSelectorPromptStr , |
|||
const wxString & | wildcard = wxFileSelectorDefaultWildcardStr , |
|||
const wxPoint & | pos = wxDefaultPosition , |
|||
const wxSize & | size = wxDefaultSize , |
|||
long | style = wxFLP_DEFAULT_STYLE , |
|||
const wxValidator & | validator = wxDefaultValidator , |
|||
const wxString & | name = wxFilePickerCtrlNameStr | |||
) |
Creates this widget with the given parameters.
parent | Parent window, must not be non-NULL. | |
id | The identifier for the control. | |
path | The initial file shown in the control. Must be a valid path to a file or the empty string. | |
message | The message shown to the user in the wxFileDialog shown by the control. | |
wildcard | A wildcard which defines user-selectable files (use the same syntax as for wxFileDialog's wildcards). | |
pos | Initial position. | |
size | Initial size. | |
style | The window style, see wxFLP_* flags. | |
validator | Validator which can be used for additional data checks. | |
name | Control name. |
wxFileName wxFilePickerCtrl::GetFileName | ( | ) | const |
Similar to GetPath() but returns the path of the currently selected file as a wxFileName object.
wxString wxFilePickerCtrl::GetPath | ( | ) | const |
Returns the absolute path of the currently selected file.
void wxFilePickerCtrl::SetFileName | ( | const wxFileName & | filename | ) |
This method does the same thing as SetPath() but takes a wxFileName object instead of a string.
void wxFilePickerCtrl::SetPath | ( | const wxString & | filename | ) |
Sets the absolute path of the currently selected file.
This must be a valid file if the wxFLP_FILE_MUST_EXIST
style was given.
![]() |
[ top ] |