wxChoice Class Reference
[Controls]

#include <wx/choice.h>

Inheritance diagram for wxChoice:

wxControlWithItems wxControl wxItemContainer wxWindow wxItemContainerImmutable wxEvtHandler wxObject

List of all members.


Detailed Description

A choice item is used to select one of a list of strings. Unlike a wxListBox, only the selection is visible until the user pulls down the menu of choices.

Styles:

Events:

The following event handler macros redirect the events to member function handlers 'func' with prototypes like:

void handlerFuncName(wxCommandEvent& event)

Event macros:
Library:  wxCore

Category:  Controls

See also:
wxListBox, wxComboBox, wxCommandEvent

Public Member Functions

 wxChoice ()
virtual ~wxChoice ()
virtual int GetColumns () const
virtual int GetCurrentSelection () const
virtual void SetColumns (int n=1)
 wxChoice (wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, int n, const wxString choices[], long style=0, const wxValidator &validator=wxDefaultValidator, const wxString &name="choice")
 wxChoice (wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, const wxArrayString &choices, long style=0, const wxValidator &validator=wxDefaultValidator, const wxString &name="choice")
bool Create (wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, int n, const wxString choices[], long style=0, const wxValidator &validator=wxDefaultValidator, const wxString &name="choice")
bool Create (wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, const wxArrayString &choices, long style=0, const wxValidator &validator=wxDefaultValidator, const wxString &name="choice")

Constructor & Destructor Documentation

wxChoice::wxChoice (  ) 

Default constructor.

See also:
Create(), wxValidator

wxChoice::wxChoice ( wxWindow parent,
wxWindowID  id,
const wxPoint pos,
const wxSize size,
int  n,
const wxString  choices[],
long  style = 0,
const wxValidator validator = wxDefaultValidator,
const wxString name = "choice" 
)

Constructor, creating and showing a choice.

Parameters:
parent Parent window. Must not be NULL.
id Window identifier. The value wxID_ANY indicates a default value.
pos Window position.
size Window size. If wxDefaultSize is specified then the choice is sized appropriately.
n Number of strings with which to initialise the choice control.
choices An array of strings with which to initialise the choice control.
style Window style. See wxChoice.
validator Window validator.
name Window name.
See also:
Create(), wxValidator
wxPython Note:

The wxChoice constructor in wxPython reduces the n and choices arguments to a single argument, which is a list of strings.

wxChoice::wxChoice ( wxWindow parent,
wxWindowID  id,
const wxPoint pos,
const wxSize size,
const wxArrayString choices,
long  style = 0,
const wxValidator validator = wxDefaultValidator,
const wxString name = "choice" 
)

Constructor, creating and showing a choice.

Parameters:
parent Parent window. Must not be NULL.
id Window identifier. The value wxID_ANY indicates a default value.
pos Window position.
size Window size. If wxDefaultSize is specified then the choice is sized appropriately.
choices An array of strings with which to initialise the choice control.
style Window style. See wxChoice.
validator Window validator.
name Window name.
See also:
Create(), wxValidator
wxPython Note:

The wxChoice constructor in wxPython reduces the n and choices arguments to a single argument, which is a list of strings.

virtual wxChoice::~wxChoice (  )  [virtual]

Destructor, destroying the choice item.


Member Function Documentation

bool wxChoice::Create ( wxWindow parent,
wxWindowID  id,
const wxPoint pos,
const wxSize size,
int  n,
const wxString  choices[],
long  style = 0,
const wxValidator validator = wxDefaultValidator,
const wxString name = "choice" 
)

Creates the choice for two-step construction. See wxChoice().

bool wxChoice::Create ( wxWindow parent,
wxWindowID  id,
const wxPoint pos,
const wxSize size,
const wxArrayString choices,
long  style = 0,
const wxValidator validator = wxDefaultValidator,
const wxString name = "choice" 
)

Creates the choice for two-step construction. See wxChoice().

virtual int wxChoice::GetColumns (  )  const [virtual]

Gets the number of columns in this choice item.

Remarks:
This is implemented for GTK and Motif only and always returns 1 for the other platforms.

virtual int wxChoice::GetCurrentSelection (  )  const [virtual]

Unlike wxControlWithItems::GetSelection() which only returns the accepted selection value, i.e. the selection in the control once the user closes the dropdown list, this function returns the current selection. That is, while the dropdown list is shown, it returns the currently selected item in it. When it is not shown, its result is the same as for the other function.

Since:
2.6.2. In older versions, wxControlWithItems::GetSelection() itself behaved like this.

virtual void wxChoice::SetColumns ( int  n = 1  )  [virtual]

Sets the number of columns in this choice item.

Parameters:
n Number of columns.
Remarks:
This is implemented for GTK and Motif only and doesn’t do anything under other platforms.



wxWidgets logo

[ top ]