wxRuby Documentation Home

# Wx::DirDialog

This class represents the directory chooser dialog.

## Derived from

Dialog

Window

EvtHandler

Object

## Window styles

`DD_DEFAULT_STYLE` | Equivalent to a combination of DEFAULT_DIALOG_STYLE and RESIZE_BORDER (the last one is not used under WinCE).
`DD_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.
`DD_CHANGE_DIR` | Change the current working directory to the directory chosen by the user.

NB: on Windows the new directory button is only available with recent versions of the common dialogs.

See also Generic window styles.

## See also

DirDialog overview, FileDialog

## Methods

- DirDialog.new
- DirDialog#get_path
- DirDialog#get_message
- DirDialog#set_message
- DirDialog#set_path
- DirDialog#show_modal

### DirDialog.new

DirDialog.new(%(arg-type)Window% parent, String message = “Choose a directory”, String defaultPath = "", Integer style = DD_DEFAULT_STYLE, Point pos = DEFAULT_POSITION, Size size = DEFAULT_SIZE, String name = “DirCtrl”)

Constructor. Use DirDialog#show_modal 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 DirDialog
- pos Dialog position. Ignored under Windows.
- size Dialog size. Ignored under Windows.
- name The dialog name, not used.

destructor()

Destructor.

### DirDialog#get_path

String get_path()

Returns the default or user-selected path.

### DirDialog#get_message

String get_message()

Returns the message that will be displayed on the dialog.

### DirDialog#set_message

set_message(%(arg-type)String% message)

Sets the message that will be displayed on the dialog.

### DirDialog#set_path

set_path(%(arg-type)String% path)

Sets the default path.

### DirDialog#show_modal

Integer show_modal()

Shows the dialog, returning ID_OK if the user pressed OK, and ID_CANCEL
otherwise.

[This page automatically generated from the Textile source at 2023-06-09 00:45:28 +0000]