wxRuby Documentation Home

# Wx::SingleChoiceDialog

This class represents a dialog that shows a list of strings, and allows the
user to select one. Double-clicking on a list item is equivalent to
single-clicking and then pressing OK.

## Derived from

Dialog

Window

EvtHandler

Object

## See also

SingleChoiceDialog overview,
MultiChoiceDialog

## Methods

- SingleChoiceDialog.new
- SingleChoiceDialog#get_selection
- SingleChoiceDialog#get_string_selection
- SingleChoiceDialog#set_selection
- SingleChoiceDialog#show_modal

### SingleChoiceDialog.new

SingleChoiceDialog.new(%(arg-type)Window% parent, String message, String caption, Integer n, String choices, (arg-type) clientData = nil, Integer style = CHOICEDLG_STYLE, Point pos = DEFAULT_POSITION) SingleChoiceDialog.new(%(arg-type)Window% parent, String message, String caption, ArrayString choices, Integer style = CHOICEDLG_STYLE, Point pos = DEFAULT_POSITION)

Constructor, taking an array of String choices and optional client data.

#### Parameters

- parent Parent window.
- message Message to show on the dialog.
- caption The dialog caption.
- n The number of choices.
- choices An array of strings, or a string list, containing the choices.
- style A dialog style (bitlist) containing flags chosen from standard
  dialog styles and the following:

`OK` | Show an OK button.
`CANCEL` | Show a Cancel button.
`CENTRE` | Centre the message. Not Windows.

The default value is equivalent to `DEFAULT_DIALOG_STYLE`|`RESIZE_BORDER`|`OK`|`CANCEL`|`CENTRE`.

- pos Dialog position. Not Windows.

#### Remarks

Use SingleChoiceDialog#show_modal to show the dialog.

### SingleChoiceDialog#get_selection

Integer get_selection()

Returns the index of selected item.

### SingleChoiceDialog#get_string_selection

String get_string_selection()

Returns the selected string.

### SingleChoiceDialog#set_selection

set_selection(%(arg-type)Integer% selection)

Sets the index of the initially selected item.

### SingleChoiceDialog#show_modal

Integer show_modal()

Shows the dialog, returning either ID_OK or ID_CANCEL.

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