1wxControlWithItems(3) Erlang Module Definition wxControlWithItems(3)
2
3
4
6 wxControlWithItems - Functions for wxControlWithItems class
7
9 This is convenience class that derives from both wxControl and wxItem‐
10 Container (not implemented in wx). It is used as basis for some wxWid‐
11 gets controls (wxChoice and wxListBox).
12
13 See: wxItemContainer (not implemented in wx), wxItemContainerImmutable
14 (not implemented in wx)
15
16 This class is derived (and can use functions) from: wxControl wxWindow
17 wxEvtHandler
18
19 wxWidgets docs: wxControlWithItems
20
22 wxControlWithItems() = wx:wx_object()
23
25 append(This, Item) -> integer()
26
27 Types:
28
29 This = wxControlWithItems()
30 Item = unicode:chardata()
31
32 Appends item into the control.
33
34 Return: The return value is the index of the newly inserted
35 item. Note that this may be different from the last one if the
36 control is sorted (e.g. has wxLB_SORT or wxCB_SORT style).
37
38 append(This, Item, ClientData) -> integer()
39
40 Types:
41
42 This = wxControlWithItems()
43 Item = unicode:chardata()
44 ClientData = term()
45
46 Appends item into the control.
47
48 Return: The return value is the index of the newly inserted
49 item. Note that this may be different from the last one if the
50 control is sorted (e.g. has wxLB_SORT or wxCB_SORT style).
51
52 appendStrings(This, Items) -> integer()
53
54 Types:
55
56 This = wxControlWithItems()
57 Items = [unicode:chardata()]
58
59 Appends several items at once into the control.
60
61 Notice that calling this method is usually much faster than ap‐
62 pending them one by one if you need to add a lot of items.
63
64 appendStrings(This, Items, ClientsData) -> integer()
65
66 Types:
67
68 This = wxControlWithItems()
69 Items = [unicode:chardata()]
70 ClientsData = [term()]
71
72 Appends several items at once into the control.
73
74 Notice that calling this method is usually much faster than ap‐
75 pending them one by one if you need to add a lot of items.
76
77 clear(This) -> ok
78
79 Types:
80
81 This = wxControlWithItems()
82
83 Removes all items from the control.
84
85 clear/1 also deletes the client data of the existing items if it
86 is owned by the control.
87
88 delete(This, N) -> ok
89
90 Types:
91
92 This = wxControlWithItems()
93 N = integer()
94
95 Deletes an item from the control.
96
97 The client data associated with the item will be also deleted if
98 it is owned by the control. Note that it is an error (signalled
99 by an assert failure in debug builds) to remove an item with the
100 index negative or greater or equal than the number of items in
101 the control.
102
103 If there is a currently selected item below the item being
104 deleted, i.e. if getSelection/1 returns a valid index greater
105 than or equal to n, the selection is invalidated when this func‐
106 tion is called. However if the selected item appears before the
107 item being deleted, the selection is preserved unchanged.
108
109 See: clear/1
110
111 findString(This, String) -> integer()
112
113 Types:
114
115 This = wxControlWithItems()
116 String = unicode:chardata()
117
118 findString(This, String, Options :: [Option]) -> integer()
119
120 Types:
121
122 This = wxControlWithItems()
123 String = unicode:chardata()
124 Option = {bCase, boolean()}
125
126 Finds an item whose label matches the given string.
127
128 Return: The zero-based position of the item, or wxNOT_FOUND if
129 the string was not found.
130
131 getClientData(This, N) -> term()
132
133 Types:
134
135 This = wxControlWithItems()
136 N = integer()
137
138 Returns a pointer to the client data associated with the given
139 item (if any).
140
141 It is an error to call this function for a control which doesn't
142 have typed client data at all although it is OK to call it even
143 if the given item doesn't have any client data associated with
144 it (but other items do).
145
146 Notice that the returned pointer is still owned by the control
147 and will be deleted by it, use DetachClientObject() (not imple‐
148 mented in wx) if you want to remove the pointer from the con‐
149 trol.
150
151 Return: A pointer to the client data, or NULL if not present.
152
153 setClientData(This, N, Data) -> ok
154
155 Types:
156
157 This = wxControlWithItems()
158 N = integer()
159 Data = term()
160
161 Associates the given typed client data pointer with the given
162 item: the data object will be deleted when the item is deleted
163 (either explicitly by using delete/2 or implicitly when the con‐
164 trol itself is destroyed).
165
166 Note that it is an error to call this function if any untyped
167 client data pointers had been associated with the control items
168 before.
169
170 getCount(This) -> integer()
171
172 Types:
173
174 This = wxControlWithItems()
175
176 Returns the number of items in the control.
177
178 See: isEmpty/1
179
180 getSelection(This) -> integer()
181
182 Types:
183
184 This = wxControlWithItems()
185
186 Returns the index of the selected item or wxNOT_FOUND if no item
187 is selected.
188
189 Return: The position of the current selection.
190
191 Remark: This method can be used with single selection list boxes
192 only, you should use wxListBox:getSelections/1 for the list
193 boxes with wxLB_MULTIPLE style.
194
195 See: setSelection/2, getStringSelection/1
196
197 getString(This, N) -> unicode:charlist()
198
199 Types:
200
201 This = wxControlWithItems()
202 N = integer()
203
204 Returns the label of the item with the given index.
205
206 Return: The label of the item or an empty string if the position
207 was invalid.
208
209 getStringSelection(This) -> unicode:charlist()
210
211 Types:
212
213 This = wxControlWithItems()
214
215 Returns the label of the selected item or an empty string if no
216 item is selected.
217
218 See: getSelection/1
219
220 insert(This, Item, Pos) -> integer()
221
222 Types:
223
224 This = wxControlWithItems()
225 Item = unicode:chardata()
226 Pos = integer()
227
228 Inserts item into the control.
229
230 Return: The return value is the index of the newly inserted
231 item. If the insertion failed for some reason, -1 is returned.
232
233 insert(This, Item, Pos, ClientData) -> integer()
234
235 Types:
236
237 This = wxControlWithItems()
238 Item = unicode:chardata()
239 Pos = integer()
240 ClientData = term()
241
242 Inserts item into the control.
243
244 Return: The return value is the index of the newly inserted
245 item. If the insertion failed for some reason, -1 is returned.
246
247 insertStrings(This, Items, Pos) -> integer()
248
249 Types:
250
251 This = wxControlWithItems()
252 Items = [unicode:chardata()]
253 Pos = integer()
254
255 Inserts several items at once into the control.
256
257 Notice that calling this method is usually much faster than in‐
258 serting them one by one if you need to insert a lot of items.
259
260 Return: The return value is the index of the last inserted item.
261 If the insertion failed for some reason, -1 is returned.
262
263 insertStrings(This, Items, Pos, ClientsData) -> integer()
264
265 Types:
266
267 This = wxControlWithItems()
268 Items = [unicode:chardata()]
269 Pos = integer()
270 ClientsData = [term()]
271
272 Inserts several items at once into the control.
273
274 Notice that calling this method is usually much faster than in‐
275 serting them one by one if you need to insert a lot of items.
276
277 Return: The return value is the index of the last inserted item.
278 If the insertion failed for some reason, -1 is returned.
279
280 isEmpty(This) -> boolean()
281
282 Types:
283
284 This = wxControlWithItems()
285
286 Returns true if the control is empty or false if it has some
287 items.
288
289 See: getCount/1
290
291 select(This, N) -> ok
292
293 Types:
294
295 This = wxControlWithItems()
296 N = integer()
297
298 This is the same as setSelection/2 and exists only because it is
299 slightly more natural for controls which support multiple selec‐
300 tion.
301
302 setSelection(This, N) -> ok
303
304 Types:
305
306 This = wxControlWithItems()
307 N = integer()
308
309 Sets the selection to the given item n or removes the selection
310 entirely if n == wxNOT_FOUND.
311
312 Note that this does not cause any command events to be emitted
313 nor does it deselect any other items in the controls which sup‐
314 port multiple selections.
315
316 See: setString/3, setStringSelection/2
317
318 setString(This, N, String) -> ok
319
320 Types:
321
322 This = wxControlWithItems()
323 N = integer()
324 String = unicode:chardata()
325
326 Sets the label for the given item.
327
328 setStringSelection(This, String) -> boolean()
329
330 Types:
331
332 This = wxControlWithItems()
333 String = unicode:chardata()
334
335 Selects the item with the specified string in the control.
336
337 This method doesn't cause any command events to be emitted.
338
339 Notice that this method is case-insensitive, i.e. the string is
340 compared with all the elements of the control case-insensitively
341 and the first matching entry is selected, even if it doesn't
342 have exactly the same case as this string and there is an exact
343 match afterwards.
344
345 Return: true if the specified string has been selected, false if
346 it wasn't found in the control.
347
348
349
350wxWidgets team. wx 2.2.1 wxControlWithItems(3)