wxWidgets: interface/wx/choicdlg.h File Reference

| Version: 3.1.7

Loading...
Searching...
No Matches
Classes | Macros | Functions
choicdlg.h File Reference

## Classes
class | wxMultiChoiceDialog
| This class represents a dialog that shows a list of strings, and allows the user to select one or more. More...
class | wxSingleChoiceDialog
| This class represents a dialog that shows a list of strings, and allows the user to select one. More...

## Macros
#define | wxCHOICE_WIDTH 150
| Default width of the choice dialog.
#define | wxCHOICE_HEIGHT 200
| Default height of the choice dialog.
#define | wxCHOICEDLG_STYLE (wxDEFAULT_DIALOG_STYLE | wxOK | wxCANCEL | wxCENTRE | wxRESIZE_BORDER)
| Default style of the choice dialog.

## Functions
int | wxGetSingleChoiceIndex (const wxString &message, const wxString &caption, const wxArrayString &aChoices, wxWindow *parent=NULL, int x=wxDefaultCoord, int y=wxDefaultCoord, bool centre=true, int width=wxCHOICE_WIDTH, int height=wxCHOICE_HEIGHT, int initialSelection=0)
| Same as wxGetSingleChoice() but returns the index representing the selected string.
int | wxGetSingleChoiceIndex (const wxString &message, const wxString &caption, int n, const wxString &choices[], wxWindow *parent=NULL, int x=wxDefaultCoord, int y=wxDefaultCoord, bool centre=true, int width=wxCHOICE_WIDTH, int height=wxCHOICE_HEIGHT, int initialSelection=0)
int | wxGetSingleChoiceIndex (const wxString &message, const wxString &caption, const wxArrayString &choices, int initialSelection, wxWindow *parent=NULL)
int | wxGetSingleChoiceIndex (const wxString &message, const wxString &caption, int n, const wxString *choices, int initialSelection, wxWindow *parent=NULL)
wxString | wxGetSingleChoice (const wxString &message, const wxString &caption, const wxArrayString &aChoices, wxWindow *parent=NULL, int x=wxDefaultCoord, int y=wxDefaultCoord, bool centre=true, int width=wxCHOICE_WIDTH, int height=wxCHOICE_HEIGHT, int initialSelection=0)
| Pops up a dialog box containing a message, OK/Cancel buttons and a single-selection listbox.
wxString | wxGetSingleChoice (const wxString &message, const wxString &caption, int n, const wxString &choices[], wxWindow *parent=NULL, int x=wxDefaultCoord, int y=wxDefaultCoord, bool centre=true, int width=wxCHOICE_WIDTH, int height=wxCHOICE_HEIGHT, int initialSelection=0)
wxString | wxGetSingleChoice (const wxString &message, const wxString &caption, const wxArrayString &choices, int initialSelection, wxWindow *parent=NULL)
wxString | wxGetSingleChoice (const wxString &message, const wxString &caption, int n, const wxString *choices, int initialSelection, wxWindow *parent=NULL)
wxString | wxGetSingleChoiceData (const wxString &message, const wxString &caption, const wxArrayString &aChoices, const wxString &client_data[], wxWindow *parent=NULL, int x=wxDefaultCoord, int y=wxDefaultCoord, bool centre=true, int width=wxCHOICE_WIDTH, int height=wxCHOICE_HEIGHT, int initialSelection=0)
| Same as wxGetSingleChoice but takes an array of client data pointers corresponding to the strings, and returns one of these pointers or NULL if Cancel was pressed.
wxString | wxGetSingleChoiceData (const wxString &message, const wxString &caption, int n, const wxString &choices[], const wxString &client_data[], wxWindow *parent=NULL, int x=wxDefaultCoord, int y=wxDefaultCoord, bool centre=true, int width=wxCHOICE_WIDTH, int height=wxCHOICE_HEIGHT, int initialSelection=0)
void * | wxGetSingleChoiceData (const wxString &message, const wxString &caption, const wxArrayString &choices, void **client_data, int initialSelection, wxWindow *parent=NULL)
void * | wxGetSingleChoiceData (const wxString &message, const wxString &caption, int n, const wxString *choices, void **client_data, int initialSelection, wxWindow *parent=NULL)
int | wxGetSelectedChoices (wxArrayInt &selections, const wxString &message, const wxString &caption, const wxArrayString &aChoices, wxWindow *parent=NULL, int x=wxDefaultCoord, int y=wxDefaultCoord, bool centre=true, int width=wxCHOICE_WIDTH, int height=wxCHOICE_HEIGHT)
| Pops up a dialog box containing a message, OK/Cancel buttons and a multiple-selection listbox.
int | wxGetSelectedChoices (wxArrayInt &selections, const wxString &message, const wxString &caption, int n, const wxString &choices[], wxWindow *parent=NULL, int x=wxDefaultCoord, int y=wxDefaultCoord, bool centre=true, int width=wxCHOICE_WIDTH, int height=wxCHOICE_HEIGHT)

## Macro Definition Documentation

## ◆ wxCHOICE_HEIGHT

#define wxCHOICE_HEIGHT 200

Default height of the choice dialog.

## ◆ wxCHOICE_WIDTH

#define wxCHOICE_WIDTH 150

Default width of the choice dialog.

## ◆ wxCHOICEDLG_STYLE

#define wxCHOICEDLG_STYLE (wxDEFAULT_DIALOG_STYLE | wxOK | wxCANCEL | wxCENTRE | wxRESIZE_BORDER)

Default style of the choice dialog.

## Function Documentation

## ◆ wxGetSelectedChoices() [1/2]

int wxGetSelectedChoices | ( | wxArrayInt & | selections,
|  | const wxString & | message,
|  | const wxString & | caption,
|  | const wxArrayString & | aChoices,
|  | wxWindow * | parent = NULL,
|  | int | x = wxDefaultCoord,
|  | int | y = wxDefaultCoord,
|  | bool | centre = true,
|  | int | width = wxCHOICE_WIDTH,
|  | int | height = wxCHOICE_HEIGHT )

Pops up a dialog box containing a message, OK/Cancel buttons and a multiple-selection listbox.

The user may choose an arbitrary (including 0) number of items in the listbox whose indices will be returned in `selections` array. The initial contents of this array will be used to select the items when the dialog is shown. If the user cancels the dialog, the function returns -1 and `selections` array is left unchanged.

You may pass the list of strings to choose from either using `choices` which is an array of n strings for the listbox or by using a single `aChoices` parameter of type wxArrayString.

If `centre` is true, the message text (which may include new line characters) is centred; if false, the message is left-justified.

Include file:

    #include <wx/choicdlg.h>

wxPerl Note: Use an array reference for the choices parameter. In wxPerl there is no selections parameter; the function returns an array containing the user selections.

## ◆ wxGetSelectedChoices() [2/2]

int wxGetSelectedChoices | ( | wxArrayInt & | selections,
|  | const wxString & | message,
|  | const wxString & | caption,
|  | int | n,
|  | const wxString & | choices[],
|  | wxWindow * | parent = NULL,
|  | int | x = wxDefaultCoord,
|  | int | y = wxDefaultCoord,
|  | bool | centre = true,
|  | int | width = wxCHOICE_WIDTH,
|  | int | height = wxCHOICE_HEIGHT )

## ◆ wxGetSingleChoice() [1/4]

wxString wxGetSingleChoice | ( | const wxString & | message,
|  | const wxString & | caption,
|  | const wxArrayString & | aChoices,
|  | wxWindow * | parent = NULL,
|  | int | x = wxDefaultCoord,
|  | int | y = wxDefaultCoord,
|  | bool | centre = true,
|  | int | width = wxCHOICE_WIDTH,
|  | int | height = wxCHOICE_HEIGHT,
|  | int | initialSelection = 0 )

Pops up a dialog box containing a message, OK/Cancel buttons and a single-selection listbox.

The user may choose an item and press OK to return a string or Cancel to return the empty string. Use wxGetSingleChoiceIndex() if empty string is a valid choice and if you want to be able to detect pressing Cancel reliably.

You may pass the list of strings to choose from either using `choices` which is an array of n strings for the listbox or by using a single `aChoices` parameter of type wxArrayString.

If `centre` is true, the message text (which may include new line characters) is centred; if false, the message is left-justified.

Include file:

    #include <wx/choicdlg.h>

wxPerl Note: Use an array reference for the choices parameter.

## ◆ wxGetSingleChoice() [2/4]

wxString wxGetSingleChoice | ( | const wxString & | message,
|  | const wxString & | caption,
|  | const wxArrayString & | choices,
|  | int | initialSelection,
|  | wxWindow * | parent = NULL )

## ◆ wxGetSingleChoice() [3/4]

wxString wxGetSingleChoice | ( | const wxString & | message,
|  | const wxString & | caption,
|  | int | n,
|  | const wxString & | choices[],
|  | wxWindow * | parent = NULL,
|  | int | x = wxDefaultCoord,
|  | int | y = wxDefaultCoord,
|  | bool | centre = true,
|  | int | width = wxCHOICE_WIDTH,
|  | int | height = wxCHOICE_HEIGHT,
|  | int | initialSelection = 0 )

## ◆ wxGetSingleChoice() [4/4]

wxString wxGetSingleChoice | ( | const wxString & | message,
|  | const wxString & | caption,
|  | int | n,
|  | const wxString * | choices,
|  | int | initialSelection,
|  | wxWindow * | parent = NULL )

## ◆ wxGetSingleChoiceData() [1/4]

wxString wxGetSingleChoiceData | ( | const wxString & | message,
|  | const wxString & | caption,
|  | const wxArrayString & | aChoices,
|  | const wxString & | client_data[],
|  | wxWindow * | parent = NULL,
|  | int | x = wxDefaultCoord,
|  | int | y = wxDefaultCoord,
|  | bool | centre = true,
|  | int | width = wxCHOICE_WIDTH,
|  | int | height = wxCHOICE_HEIGHT,
|  | int | initialSelection = 0 )

Same as wxGetSingleChoice but takes an array of client data pointers corresponding to the strings, and returns one of these pointers or NULL if Cancel was pressed.

The `client_data` array must have the same number of elements as `choices` or `aChoices!`

Include file:

    #include <wx/choicdlg.h>

wxPerl Note: Use an array reference for the aChoices and client_data parameters.

## ◆ wxGetSingleChoiceData() [2/4]

void * wxGetSingleChoiceData | ( | const wxString & | message,
|  | const wxString & | caption,
|  | const wxArrayString & | choices,
|  | void ** | client_data,
|  | int | initialSelection,
|  | wxWindow * | parent = NULL )

## ◆ wxGetSingleChoiceData() [3/4]

wxString wxGetSingleChoiceData | ( | const wxString & | message,
|  | const wxString & | caption,
|  | int | n,
|  | const wxString & | choices[],
|  | const wxString & | client_data[],
|  | wxWindow * | parent = NULL,
|  | int | x = wxDefaultCoord,
|  | int | y = wxDefaultCoord,
|  | bool | centre = true,
|  | int | width = wxCHOICE_WIDTH,
|  | int | height = wxCHOICE_HEIGHT,
|  | int | initialSelection = 0 )

## ◆ wxGetSingleChoiceData() [4/4]

void * wxGetSingleChoiceData | ( | const wxString & | message,
|  | const wxString & | caption,
|  | int | n,
|  | const wxString * | choices,
|  | void ** | client_data,
|  | int | initialSelection,
|  | wxWindow * | parent = NULL )

## ◆ wxGetSingleChoiceIndex() [1/4]

int wxGetSingleChoiceIndex | ( | const wxString & | message,
|  | const wxString & | caption,
|  | const wxArrayString & | aChoices,
|  | wxWindow * | parent = NULL,
|  | int | x = wxDefaultCoord,
|  | int | y = wxDefaultCoord,
|  | bool | centre = true,
|  | int | width = wxCHOICE_WIDTH,
|  | int | height = wxCHOICE_HEIGHT,
|  | int | initialSelection = 0 )

Same as wxGetSingleChoice() but returns the index representing the selected string.

If the user pressed cancel, -1 is returned.

Include file:

    #include <wx/choicdlg.h>

wxPerl Note: Use an array reference for the aChoices parameter.

## ◆ wxGetSingleChoiceIndex() [2/4]

int wxGetSingleChoiceIndex | ( | const wxString & | message,
|  | const wxString & | caption,
|  | const wxArrayString & | choices,
|  | int | initialSelection,
|  | wxWindow * | parent = NULL )

## ◆ wxGetSingleChoiceIndex() [3/4]

int wxGetSingleChoiceIndex | ( | const wxString & | message,
|  | const wxString & | caption,
|  | int | n,
|  | const wxString & | choices[],
|  | wxWindow * | parent = NULL,
|  | int | x = wxDefaultCoord,
|  | int | y = wxDefaultCoord,
|  | bool | centre = true,
|  | int | width = wxCHOICE_WIDTH,
|  | int | height = wxCHOICE_HEIGHT,
|  | int | initialSelection = 0 )

## ◆ wxGetSingleChoiceIndex() [4/4]

int wxGetSingleChoiceIndex | ( | const wxString & | message,
|  | const wxString & | caption,
|  | int | n,
|  | const wxString * | choices,
|  | int | initialSelection,
|  | wxWindow * | parent = NULL )