# wxDirDialog Class Reference
[Common Dialogs]

`#include </home/work/projects/wx/2.9/wx/interface/wx/dirdlg.h>`

Inheritance diagram for wxDirDialog:
[legend]

## Detailed Description

This class represents the directory chooser dialog.

## Styles

This class supports the following styles:

- wxDD_DEFAULT_STYLE:
  Equivalent to a combination of wxDEFAULT_DIALOG_STYLE and wxRESIZE_BORDER (the last one is not used under wxWinCE).
- wxDD_DIR_MUST_EXIST:
  The dialog will allow the user to choose only an existing folder. When this style is not given, a "Create new directory" button is added to the dialog (on Windows) or some other way is provided to the user to type the name of a new folder.
- wxDD_CHANGE_DIR:
  Change the current working directory to the directory chosen by the user.

Notice that `wxRESIZE_BORDER` has special side effect under recent (i.e. later than Win9x) Windows where two different directory selection dialogs are available and this style also implicitly selects the new version as the old one always has fixed size. As the new version is almost always preferable, it is recommended that `wxRESIZE_BORDER` style be always used. This is the case if the dialog is created with the default style value but if you need to use any additional styles you should still specify `wxDD_DEFAULT_STYLE` unless you explicitly need to use the old dialog version under Windows. E.g. do

            wxDirDialog dlg(NULL, "Choose input directory", "",
                            wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);

instead of just using `wxDD_DIR_MUST_EXIST` style alone.

##

Library: wxCore
Category: Common Dialogs

See also:
  wxDirDialog Overview, wxFileDialog

## Public Member Functions

| wxDirDialog (wxWindow *parent, const wxString &message=wxDirSelectorPromptStr, const wxString &defaultPath=wxEmptyString, long style=wxDD_DEFAULT_STYLE, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, const wxString &name=wxDirDialogNameStr)
| Constructor.
virtual | ~wxDirDialog ()
| Destructor.
virtual wxString | GetMessage () const
| Returns the message that will be displayed on the dialog.
virtual wxString | GetPath () const
| Returns the default or user-selected path.
virtual void | SetMessage (const wxString &message)
| Sets the message that will be displayed on the dialog.
virtual void | SetPath (const wxString &path)
| Sets the default path.
int | ShowModal ()
| Shows the dialog, returning wxID_OK if the user pressed OK, and wxID_CANCEL otherwise.

List of all members.

## Constructor & Destructor Documentation

wxDirDialog::wxDirDialog | ( | wxWindow * | parent,
|  | const wxString & | message = `wxDirSelectorPromptStr`,
|  | const wxString & | defaultPath = `wxEmptyString`,
|  | long | style = `wxDD_DEFAULT_STYLE`,
|  | const wxPoint & | pos = `wxDefaultPosition`,
|  | const wxSize & | size = `wxDefaultSize`,
|  | const wxString & | name = `wxDirDialogNameStr` |
| ) |  |  |

Constructor.

Use ShowModal() to show the dialog.

Parameters:

  | parent | Parent window.
  | message | Message to show on the dialog.
  | defaultPath | The default path, or the empty string.
  | style | The dialog style. See wxDirDialog
  | pos | Dialog position. Ignored under Windows.
  | size | Dialog size. Ignored under Windows.
  | name | The dialog name, not used.

virtual wxDirDialog::~wxDirDialog | ( |  | ) | `[virtual]`

Destructor.

## Member Function Documentation

virtual wxString wxDirDialog::GetMessage | ( |  | ) | const`[virtual]`

Returns the message that will be displayed on the dialog.

virtual wxString wxDirDialog::GetPath | ( |  | ) | const`[virtual]`

Returns the default or user-selected path.

virtual void wxDirDialog::SetMessage | ( | const wxString & | message | ) | `[virtual]`

Sets the message that will be displayed on the dialog.

virtual void wxDirDialog::SetPath | ( | const wxString & | path | ) | `[virtual]`

Sets the default path.

int wxDirDialog::ShowModal | ( |  | ) | `[virtual]`

Shows the dialog, returning wxID_OK if the user pressed OK, and wxID_CANCEL otherwise.

Reimplemented from wxDialog.

|  | [ top ]