1 \section{\class{wxChoice
}}\label{wxchoice
}
3 A choice item is used to select one of a list of strings. Unlike a
4 listbox, only the selection is visible until the user pulls down the
7 \wxheading{Derived from
}
9 \helpref{wxControlWithItems
}{wxcontrolwithitems
}\\
10 \helpref{wxControl
}{wxcontrol
}\\
11 \helpref{wxWindow
}{wxwindow
}\\
12 \helpref{wxEvtHandler
}{wxevthandler
}\\
13 \helpref{wxObject
}{wxobject
}
15 \wxheading{Include files
}
19 \wxheading{Window styles
}
21 There are no special styles for wxChoice.
23 See also
\helpref{window styles overview
}{windowstyles
}.
25 \wxheading{Event handling
}
28 \begin{twocollist
}\itemsep=
0pt
29 \twocolitem{{\bf EVT
\_CHOICE(id, func)
}}{Process a wxEVT
\_COMMAND\_CHOICE\_SELECTED event,
30 when an item on the list is selected.
}
35 \helpref{wxListBox
}{wxlistbox
},
\helpref{wxComboBox
}{wxcombobox
},
36 \rtfsp\helpref{wxCommandEvent
}{wxcommandevent
}
38 \latexignore{\rtfignore{\wxheading{Members
}}}
41 \membersection{wxChoice::wxChoice
}\label{wxchoicector
}
43 \func{}{wxChoice
}{\void}
47 \func{}{wxChoice
}{\param{wxWindow *
}{parent
},
\param{wxWindowID
}{ id
},
\rtfsp
48 \param{const wxPoint\&
}{pos
},
\param{const wxSize\&
}{ size
},
\rtfsp
49 \param{int
}{ n
},
\param{const wxString
}{choices
[]},
\rtfsp
50 \param{long
}{ style =
0},
\param{const wxValidator\&
}{validator = wxDefaultValidator
},
\param{const wxString\&
}{name = ``choice"
}}
52 \func{}{wxChoice
}{\param{wxWindow *
}{parent
},
\param{wxWindowID
}{ id
},
\rtfsp
53 \param{const wxPoint\&
}{pos
},
\param{const wxSize\&
}{ size
},
\rtfsp
54 \param{const wxArrayString\&
}{choices
},
\rtfsp
55 \param{long
}{ style =
0},
\param{const wxValidator\&
}{validator = wxDefaultValidator
},
\param{const wxString\&
}{name = ``choice"
}}
57 Constructor, creating and showing a choice.
59 \wxheading{Parameters
}
61 \docparam{parent
}{Parent window. Must not be NULL.
}
63 \docparam{id
}{Window identifier. A value of -
1 indicates a default value.
}
65 \docparam{pos
}{Window position.
}
67 \docparam{size
}{Window size. If the default size (-
1, -
1) is specified then the choice is sized
70 \docparam{n
}{Number of strings with which to initialise the choice control.
}
72 \docparam{choices
}{An array of strings with which to initialise the choice control.
}
74 \docparam{style
}{Window style. See
\helpref{wxChoice
}{wxchoice
}.
}
76 \docparam{validator
}{Window validator.
}
78 \docparam{name
}{Window name.
}
82 \helpref{wxChoice::Create
}{wxchoicecreate
},
\helpref{wxValidator
}{wxvalidator
}
84 \pythonnote{The wxChoice constructor in wxPython reduces the
{\tt n
}
85 and
{\tt choices
} arguments are to a single argument, which is
88 \perlnote{In wxPerl there is just an array reference in place of
{\tt n
}
92 \membersection{wxChoice::
\destruct{wxChoice
}}\label{wxchoicedtor
}
94 \func{}{\destruct{wxChoice
}}{\void}
96 Destructor, destroying the choice item.
99 \membersection{wxChoice::Create
}\label{wxchoicecreate
}
101 \func{bool
}{Create
}{\param{wxWindow *
}{parent
},
\param{wxWindowID
}{ id
},
\rtfsp
102 \param{const wxPoint\&
}{pos
},
\param{const wxSize\&
}{ size
},
\rtfsp
103 \param{int
}{ n
},
\param{const wxString
}{choices
[]},
\rtfsp
104 \param{long
}{ style =
0},
\param{const wxValidator\&
}{validator = wxDefaultValidator
},
\rtfsp
105 \param{const wxString\&
}{name = ``choice"
}}
107 \func{bool
}{Create
}{\param{wxWindow *
}{parent
},
\param{wxWindowID
}{ id
},
\rtfsp
108 \param{const wxPoint\&
}{pos
},
\param{const wxSize\&
}{ size
},
\rtfsp
109 \param{const wxArrayString\&
}{choices
},
\rtfsp
110 \param{long
}{ style =
0},
\param{const wxValidator\&
}{validator = wxDefaultValidator
},
\rtfsp
111 \param{const wxString\&
}{name = ``choice"
}}
113 Creates the choice for two-step construction. See
\helpref{wxChoice::wxChoice
}{wxchoicector
}.
116 \membersection{wxChoice::Delete
}\label{wxchoicedelete
}
118 \func{void
}{Delete
}{\param{int
}{n
}}
120 Deletes the item with the given index from the control.
122 \wxheading{Parameters
}
124 \docparam{n
}{The item to delete.
}
127 \membersection{wxChoice::GetColumns
}\label{wxchoicegetcolumns
}
129 \constfunc{int
}{GetColumns
}{\void}
131 Gets the number of columns in this choice item.
135 This is implemented for Motif only and always returns $
1$ for the other
139 \membersection{wxChoice::GetCurrentSelection
}\label{wxchoicegetcurrentselection
}
141 \constfunc{int
}{GetCurrentSelection
}{\void}
143 Unlike
\helpref{GetSelection
}{wxcontrolwithitemsgetselection
} which only
144 returns the accepted selection value, i.e. the selection in the control once
145 the user closes the dropdown list, this function returns the current selection.
146 That is, while the dropdown list is shown, it returns the currently selected
147 item in it. When it is not shown, its result is the same as for the other
150 \newsince{2.6.2} (before this version
151 \helpref{GetSelection
}{wxcontrolwithitemsgetselection
} itself behaved like
155 \membersection{wxChoice::SetColumns
}\label{wxchoicesetcolumns
}
157 \func{void
}{SetColumns
}{\param{int
}{ n =
1}}
159 Sets the number of columns in this choice item.
161 \wxheading{Parameters
}
163 \docparam{n
}{Number of columns.
}
167 This is implemented for Motif only and doesn't do anything under other