File: wx41.htm

package info (click to toggle)
wxwin2-doc 2.01-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 6,540 kB
  • ctags: 5,968
  • sloc: cpp: 15,157; makefile: 434; sh: 6
file content (242 lines) | stat: -rw-r--r-- 8,164 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
<HTML>
<head><title>wxChoice</title></head>

<BODY BGCOLOR=#FFFFFF>
<A NAME="wxchoice"></A><CENTER>
<A HREF="wx.htm"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="wx22.htm#classref"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="wx40.htm#wxchecklistbox"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="wx42.htm#wxclassinfo"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>

<H2>wxChoice</H2>
<P>
A choice item is used to select one of a list of strings. Unlike a
listbox, only the selection is visible until the user pulls down the
menu of choices.<P>
<B><FONT COLOR="#FF0000">Derived from</FONT></B><P>
<A HREF="wx56.htm#wxcontrol">wxControl</A><BR>

<A HREF="wx260.htm#wxwindow">wxWindow</A><BR>

<A HREF="wx85.htm#wxevthandler">wxEvtHandler</A><BR>

<A HREF="wx158.htm#wxobject">wxObject</A><P>
<B><FONT COLOR="#FF0000">Include files</FONT></B><P>
&lt;wx/choice.h&gt;<P>
<B><FONT COLOR="#FF0000">Window styles</FONT></B><P>
There are no special styles for wxChoice.<P>
See also <A HREF="wx305.htm#windowstyles">window styles overview</A>.<P>
<B><FONT COLOR="#FF0000">Event handling</FONT></B><P>


<TABLE>


<TR><TD VALIGN=TOP>
<B>EVT_CHOICE(id, func)</B>
</TD>

<TD VALIGN=TOP>
Process a wxEVT_COMMAND_CHOICE_SELECTED event,
when an item on the list is selected.
</TD></TR>


</TABLE>
<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx128.htm#wxlistbox">wxListBox</A>, <A HREF="wx50.htm#wxcombobox">wxComboBox</A>,
<A HREF="wx52.htm#wxcommandevent">wxCommandEvent</A><P>
<B><FONT COLOR="#FF0000">Members</FONT></B><P>
<A HREF="#wxchoiceconstr">wxChoice::wxChoice</A><BR>
<A HREF="#topic77">wxChoice::~wxChoice</A><BR>
<A HREF="#wxchoiceappend">wxChoice::Append</A><BR>
<A HREF="#wxchoiceclear">wxChoice::Clear</A><BR>
<A HREF="#wxchoicecreate">wxChoice::Create</A><BR>
<A HREF="#wxchoicefindstring">wxChoice::FindString</A><BR>
<A HREF="#wxchoicegetcolumns">wxChoice::GetColumns</A><BR>
<A HREF="#wxchoicegetselection">wxChoice::GetSelection</A><BR>
<A HREF="#wxchoicegetstring">wxChoice::GetString</A><BR>
<A HREF="#wxchoicegetstringselection">wxChoice::GetStringSelection</A><BR>
<A HREF="#wxchoicenumber">wxChoice::Number</A><BR>
<A HREF="#wxchoicesetcolumns">wxChoice::SetColumns</A><BR>
<A HREF="#wxchoicesetselection">wxChoice::SetSelection</A><BR>
<A HREF="#wxchoicesetstringselection">wxChoice::SetStringSelection</A><BR>
<P>

<HR>
<A NAME="wxchoiceconstr"></A>
<H3>wxChoice::wxChoice</H3>
<P>
<B></B> <B>wxChoice</B>()<P>
Default constructor.<P>
<B></B> <B>wxChoice</B>(<B>wxWindow *</B><I>parent</I>, <B>wxWindowID</B><I> id</I>,
<B>const wxPoint&amp; </B><I>pos</I>, <B>const wxSize&amp;</B><I> size</I>,
<B>int</B><I> n</I>, <B>const wxString </B><I>choices[]</I>,
<B>long</B><I> style = 0</I>, <B>const wxValidator&amp; </B><I>validator = wxDefaultValidator</I>, <B>const wxString&amp; </B><I>name = "choice"</I>)<P>
Constructor, creating and showing a choice.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>parent</I><UL><UL>
Parent window. Must not be NULL.</UL></UL>
<P>
<I>id</I><UL><UL>
Window identifier. A value of -1 indicates a default value.</UL></UL>
<P>
<I>pos</I><UL><UL>
Window position.</UL></UL>
<P>
<I>size</I><UL><UL>
Window size. If the default size (-1, -1) is specified then the choice is sized
appropriately.</UL></UL>
<P>
<I>n</I><UL><UL>
Number of strings with which to initialise the choice control.</UL></UL>
<P>
<I>choices</I><UL><UL>
An array of strings with which to initialise the choice control.</UL></UL>
<P>
<I>style</I><UL><UL>
Window style. See <A HREF="wx41.htm#wxchoice">wxChoice</A>.</UL></UL>
<P>
<I>validator</I><UL><UL>
Window validator.</UL></UL>
<P>
<I>name</I><UL><UL>
Window name.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx41.htm#wxchoicecreate">wxChoice::Create</A>, <A HREF="wx255.htm#wxvalidator">wxValidator</A><P>
<B><FONT COLOR="#0000C8">wxPython note:</FONT></B><BR>
 The wxChoice constructor in wxPython reduces the <TT>n</TT>
and <TT>choices</TT> arguments are to a single argument, which is
a list of strings.<P>

<HR>
<A NAME="topic77"></A>
<H3>wxChoice::~wxChoice</H3>
<P>
<B></B> <B>~wxChoice</B>()<P>
Destructor, destroying the choice item.<P>

<HR>
<A NAME="wxchoiceappend"></A>
<H3>wxChoice::Append</H3>
<P>
<B>void</B> <B>Append</B>(<B>const wxString&amp; </B><I> item</I>)<P>
Adds the item to the end of the choice control.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>item</I><UL><UL>
String to add.</UL></UL>
<P>

<HR>
<A NAME="wxchoiceclear"></A>
<H3>wxChoice::Clear</H3>
<P>
<B>void</B> <B>Clear</B>()<P>
Clears the strings from the choice item.<P>

<HR>
<A NAME="wxchoicecreate"></A>
<H3>wxChoice::Create</H3>
<P>
<B>bool</B> <B>Create</B>(<B>wxWindow *</B><I>parent</I>, <B>wxWindowID</B><I> id</I>,
<B>const wxPoint&amp; </B><I>pos</I>, <B>const wxSize&amp;</B><I> size</I>,
<B>int</B><I> n</I>, <B>const wxString </B><I>choices[]</I>,
<B>long</B><I> style = 0</I>, <B>const wxString&amp; </B><I>name = "choice"</I>)<P>
Creates the choice for two-step construction. See <A HREF="wx41.htm#wxchoiceconstr">wxChoice::wxChoice</A>.<P>

<HR>
<A NAME="wxchoicefindstring"></A>
<H3>wxChoice::FindString</H3>
<P>
<B>int</B> <B>FindString</B>(<B>const wxString&amp; </B><I>string</I>) <B>const</B><P>
Finds a choice matching the given string.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>string</I><UL><UL>
String to find.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
Returns the position if found, or -1 if not found.<P>

<HR>
<A NAME="wxchoicegetcolumns"></A>
<H3>wxChoice::GetColumns</H3>
<P>
<B>int</B> <B>GetColumns</B>() <B>const</B><P>
Gets the number of columns in this choice item.<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
This is implemented for Motif only.<P>

<HR>
<A NAME="wxchoicegetselection"></A>
<H3>wxChoice::GetSelection</H3>
<P>
<B>int</B> <B>GetSelection</B>() <B>const</B><P>
Gets the id (position) of the selected string, or -1 if there is no selection.<P>

<HR>
<A NAME="wxchoicegetstring"></A>
<H3>wxChoice::GetString</H3>
<P>
<B>wxString</B> <B>GetString</B>(<B>int</B><I> n</I>) <B>const</B><P>
Returns the string at the given position.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>n</I><UL><UL>
The zero-based position.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
The string at the given position, or the empty string if <I>n</I> is invalid.<P>

<HR>
<A NAME="wxchoicegetstringselection"></A>
<H3>wxChoice::GetStringSelection</H3>
<P>
<B>wxString</B> <B>GetStringSelection</B>() <B>const</B><P>
Gets the selected string, or the empty string if no string is selected.<P>

<HR>
<A NAME="wxchoicenumber"></A>
<H3>wxChoice::Number</H3>
<P>
<B>int</B> <B>Number</B>() <B>const</B><P>
Returns the number of strings in the choice control.<P>

<HR>
<A NAME="wxchoicesetcolumns"></A>
<H3>wxChoice::SetColumns</H3>
<P>
<B>void</B> <B>SetColumns</B>(<B>int</B><I> n = 1</I>)<P>
Sets the number of columns in this choice item.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>n</I><UL><UL>
Number of columns.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
This is implemented for Motif only.<P>

<HR>
<A NAME="wxchoicesetselection"></A>
<H3>wxChoice::SetSelection</H3>
<P>
<B>void</B> <B>SetSelection</B>(<B>int</B><I> n</I>)<P>
Sets the choice by passing the desired string position.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>n</I><UL><UL>
The string position to select, starting from zero.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx41.htm#wxchoicesetstringselection">wxChoice::SetStringSelection</A><P>

<HR>
<A NAME="wxchoicesetstringselection"></A>
<H3>wxChoice::SetStringSelection</H3>
<P>
<B>void</B> <B>SetStringSelection</B>(<B>const wxString&amp; </B><I> string</I>)<P>
Sets the choice by passing the desired string.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>string</I><UL><UL>
The string to select.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx41.htm#wxchoicesetselection">wxChoice::SetSelection</A><P>


</BODY></HTML>