1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %% Purpose: wxChoice documentation
4 %% Author: wxWidgets Team
8 %% Copyright: (c) wxWidgets Team
9 %% License: wxWindows license
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 \section{\class{wxChoice
}}\label{wxchoice
}
14 A choice item is used to select one of a list of strings. Unlike a
15 listbox, only the selection is visible until the user pulls down the
18 \wxheading{Derived from
}
20 \helpref{wxControlWithItems
}{wxcontrolwithitems
}\\
21 \helpref{wxControl
}{wxcontrol
}\\
22 \helpref{wxWindow
}{wxwindow
}\\
23 \helpref{wxEvtHandler
}{wxevthandler
}\\
24 \helpref{wxObject
}{wxobject
}
26 \wxheading{Include files
}
32 \helpref{wxCore
}{librarieslist
}
34 \wxheading{Window styles
}
36 \begin{twocollist
}\itemsep=
0pt
37 \twocolitem{\windowstyle{wxCB
\_SORT}}{Sorts the entries alphabetically.
}
40 See also
\helpref{window styles overview
}{windowstyles
}.
42 \wxheading{Event handling
}
45 \begin{twocollist
}\itemsep=
0pt
46 \twocolitem{{\bf EVT
\_CHOICE(id, func)
}}{Process a wxEVT
\_COMMAND\_CHOICE\_SELECTED event,
47 when an item on the list is selected.
}
52 \helpref{wxListBox
}{wxlistbox
},
\helpref{wxComboBox
}{wxcombobox
},
53 \rtfsp\helpref{wxCommandEvent
}{wxcommandevent
}
55 \latexignore{\rtfignore{\wxheading{Members
}}}
58 \membersection{wxChoice::wxChoice
}\label{wxchoicector
}
60 \func{}{wxChoice
}{\void}
64 \func{}{wxChoice
}{\param{wxWindow *
}{parent
},
\param{wxWindowID
}{ id
},
\rtfsp
65 \param{const wxPoint\&
}{pos
},
\param{const wxSize\&
}{ size
},
\rtfsp
66 \param{int
}{ n
},
\param{const wxString
}{choices
[]},
\rtfsp
67 \param{long
}{ style =
0},
\param{const wxValidator\&
}{validator = wxDefaultValidator
},
\param{const wxString\&
}{name = ``choice"
}}
69 \func{}{wxChoice
}{\param{wxWindow *
}{parent
},
\param{wxWindowID
}{ id
},
\rtfsp
70 \param{const wxPoint\&
}{pos
},
\param{const wxSize\&
}{ size
},
\rtfsp
71 \param{const wxArrayString\&
}{choices
},
\rtfsp
72 \param{long
}{ style =
0},
\param{const wxValidator\&
}{validator = wxDefaultValidator
},
\param{const wxString\&
}{name = ``choice"
}}
74 Constructor, creating and showing a choice.
76 \wxheading{Parameters
}
78 \docparam{parent
}{Parent window. Must not be NULL.
}
80 \docparam{id
}{Window identifier. A value of -
1 indicates a default value.
}
82 \docparam{pos
}{Window position.
}
84 \docparam{size
}{Window size. If the default size (-
1, -
1) is specified then the choice is sized
87 \docparam{n
}{Number of strings with which to initialise the choice control.
}
89 \docparam{choices
}{An array of strings with which to initialise the choice control.
}
91 \docparam{style
}{Window style. See
\helpref{wxChoice
}{wxchoice
}.
}
93 \docparam{validator
}{Window validator.
}
95 \docparam{name
}{Window name.
}
99 \helpref{wxChoice::Create
}{wxchoicecreate
},
\helpref{wxValidator
}{wxvalidator
}
101 \pythonnote{The wxChoice constructor in wxPython reduces the
{\tt n
}
102 and
{\tt choices
} arguments are to a single argument, which is
105 \perlnote{In wxPerl there is just an array reference in place of
{\tt n
}
109 \membersection{wxChoice::
\destruct{wxChoice
}}\label{wxchoicedtor
}
111 \func{}{\destruct{wxChoice
}}{\void}
113 Destructor, destroying the choice item.
116 \membersection{wxChoice::Create
}\label{wxchoicecreate
}
118 \func{bool
}{Create
}{\param{wxWindow *
}{parent
},
\param{wxWindowID
}{ id
},
\rtfsp
119 \param{const wxPoint\&
}{pos
},
\param{const wxSize\&
}{ size
},
\rtfsp
120 \param{int
}{ n
},
\param{const wxString
}{choices
[]},
\rtfsp
121 \param{long
}{ style =
0},
\param{const wxValidator\&
}{validator = wxDefaultValidator
},
\rtfsp
122 \param{const wxString\&
}{name = ``choice"
}}
124 \func{bool
}{Create
}{\param{wxWindow *
}{parent
},
\param{wxWindowID
}{ id
},
\rtfsp
125 \param{const wxPoint\&
}{pos
},
\param{const wxSize\&
}{ size
},
\rtfsp
126 \param{const wxArrayString\&
}{choices
},
\rtfsp
127 \param{long
}{ style =
0},
\param{const wxValidator\&
}{validator = wxDefaultValidator
},
\rtfsp
128 \param{const wxString\&
}{name = ``choice"
}}
130 Creates the choice for two-step construction. See
\helpref{wxChoice::wxChoice
}{wxchoicector
}.
133 \membersection{wxChoice::GetColumns
}\label{wxchoicegetcolumns
}
135 \constfunc{int
}{GetColumns
}{\void}
137 Gets the number of columns in this choice item.
141 This is implemented for Motif only and always returns $
1$ for the other
145 \membersection{wxChoice::GetCurrentSelection
}\label{wxchoicegetcurrentselection
}
147 \constfunc{int
}{GetCurrentSelection
}{\void}
149 Unlike
\helpref{GetSelection
}{wxcontrolwithitemsgetselection
} which only
150 returns the accepted selection value, i.e. the selection in the control once
151 the user closes the dropdown list, this function returns the current selection.
152 That is, while the dropdown list is shown, it returns the currently selected
153 item in it. When it is not shown, its result is the same as for the other
156 \newsince{2.6.2} (before this version
157 \helpref{GetSelection
}{wxcontrolwithitemsgetselection
} itself behaved like
161 \membersection{wxChoice::SetColumns
}\label{wxchoicesetcolumns
}
163 \func{void
}{SetColumns
}{\param{int
}{ n =
1}}
165 Sets the number of columns in this choice item.
167 \wxheading{Parameters
}
169 \docparam{n
}{Number of columns.
}
173 This is implemented for Motif only and doesn't do anything under other