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{wxControl
}{wxcontrol
}\\
10 \helpref{wxWindow
}{wxwindow
}\\
11 \helpref{wxEvtHandler
}{wxevthandler
}\\
12 \helpref{wxObject
}{wxobject
}
14 \wxheading{Window styles
}
16 There are no special styles for wxChoice.
18 See also
\helpref{window styles overview
}{windowstyles
}.
22 \helpref{wxListBox
}{wxlistbox
}
24 \latexignore{\rtfignore{\wxheading{Members
}}}
26 \membersection{wxChoice::wxChoice
}\label{wxchoiceconstr
}
28 \func{}{wxChoice
}{\void}
32 \func{}{wxChoice
}{\param{wxWindow *
}{parent
},
\param{wxWindowID
}{ id
},
\rtfsp
33 \param{const wxPoint\&
}{pos
},
\param{const wxSize\&
}{ size
},
\rtfsp
34 \param{int
}{ n
},
\param{const wxString
}{choices
[]},
\rtfsp
35 \param{long
}{ style =
0},
\param{const wxValidator\&
}{validator = wxDefaultValidator
},
\param{const wxString\&
}{name = ``choice"
}}
37 Constructor, creating and showing a choice.
39 \wxheading{Parameters
}
41 \docparam{parent
}{Parent window. Must not be NULL.
}
43 \docparam{id
}{Window identifier. A value of -
1 indicates a default value.
}
45 \docparam{pos
}{Window position.
}
47 \docparam{size
}{Window size. If the default size (-
1, -
1) is specified then the choice is sized
50 \docparam{n
}{Number of strings with which to initialise the choice control.
}
52 \docparam{choices
}{An array of strings with which to initialise the choice control.
}
54 \docparam{style
}{Window style. See
\helpref{wxChoice
}{wxchoice
}.
}
56 \docparam{validator
}{Window validator.
}
58 \docparam{name
}{Window name.
}
62 \helpref{wxChoice::Create
}{wxchoicecreate
},
\helpref{wxValidator
}{wxvalidator
}
64 \membersection{wxChoice::
\destruct{wxChoice
}}
66 \func{}{\destruct{wxChoice
}}{\void}
68 Destructor, destroying the choice item.
70 \membersection{wxChoice::Append
}\label{wxchoiceappend
}
72 \func{void
}{Append
}{\param{const wxString\&
}{ item
}}
74 Adds the item to the end of the choice control.
76 \wxheading{Parameters
}
78 \docparam{item
}{String to add.
}
80 \membersection{wxChoice::Clear
}\label{wxchoiceclear
}
82 \func{void
}{Clear
}{\void}
84 Clears the strings from the choice item.
86 \membersection{wxChoice::Create
}\label{wxchoicecreate
}
88 \func{bool
}{Create
}{\param{wxWindow *
}{parent
},
\param{wxWindowID
}{ id
},
\rtfsp
89 \param{const wxPoint\&
}{pos
},
\param{const wxSize\&
}{ size
},
\rtfsp
90 \param{int
}{ n
},
\param{const wxString
}{choices
[]},
\rtfsp
91 \param{long
}{ style =
0},
\param{const wxString\&
}{name = ``choice"
}}
93 Creates the choice for two-step construction. See
\helpref{wxChoice::wxChoice
}{wxchoiceconstr
}.
95 \membersection{wxChoice::FindString
}\label{wxchoicefindstring
}
97 \constfunc{int
}{FindString
}{\param{const wxString\&
}{string
}}
99 Finds a choice matching the given string.
101 \wxheading{Parameters
}
103 \docparam{string
}{String to find.
}
105 \wxheading{Return value
}
107 Returns the position if found, or -
1 if not found.
109 \membersection{wxChoice::GetColumns
}\label{wxchoicegetcolumns
}
111 \constfunc{int
}{GetColumns
}{\void}
113 Gets the number of columns in this choice item.
117 This is implemented for Motif only.
119 \membersection{wxChoice::GetSelection
}\label{wxchoicegetselection
}
121 \constfunc{int
}{GetSelection
}{\void}
123 Gets the id (position) of the selected string, or -
1 if there is no selection.
125 \membersection{wxChoice::GetString
}\label{wxchoicegetstring
}
127 \constfunc{wxString
}{GetString
}{\param{int
}{ n
}}
129 Returns the string at the given position.
131 \wxheading{Parameters
}
133 \docparam{n
}{The zero-based position.
}
135 \wxheading{Return value
}
137 The string at the given position, or the empty string if
{\it n
} is invalid.
139 \membersection{wxChoice::GetStringSelection
}\label{wxchoicegetstringselection
}
141 \constfunc{wxString
}{GetStringSelection
}{\void}
143 Gets the selected string, or the empty string if no string is selected.
145 \membersection{wxChoice::Number
}\label{wxchoicenumber
}
147 \constfunc{int
}{Number
}{\void}
149 Returns the number of strings in the choice control.
151 \membersection{wxChoice::SetColumns
}\label{wxchoicesetcolumns
}
153 \func{void
}{SetColumns
}{\param{int
}{ n =
1}}
155 Sets the number of columns in this choice item.
157 \wxheading{Parameters
}
159 \docparam{n
}{Number of columns.
}
163 This is implemented for Motif only.
165 \membersection{wxChoice::SetSelection
}\label{wxchoicesetselection
}
167 \func{void
}{SetSelection
}{\param{int
}{ n
}}
169 Sets the choice by passing the desired string position.
171 \wxheading{Parameters
}
173 \docparam{n
}{The string position to select, starting from zero.
}
177 \helpref{wxChoice::SetStringSelection
}{wxchoicesetstringselection
}
179 \membersection{wxChoice::SetStringSelection
}\label{wxchoicesetstringselection
}
181 \func{void
}{SetStringSelection
}{\param{const wxString\&
}{ string
}}
183 Sets the choice by passing the desired string.
185 \wxheading{Parameters
}
187 \docparam{string
}{The string to select.
}
191 \helpref{wxChoice::SetSelection
}{wxchoicesetselection
}