1wxListBox(3) Erlang Module Definition wxListBox(3)
2
3
4
6 wxListBox - Functions for wxListBox class
7
9 A listbox is used to select one or more of a list of strings.
10
11 The strings are displayed in a scrolling box, with the selected
12 string(s) marked in reverse video. A listbox can be single selection
13 (if an item is selected, the previous selection is removed) or multiple
14 selection (clicking an item toggles the item on or off independently of
15 other selections).
16
17 List box elements are numbered from zero and while the maximal number
18 of elements is unlimited, it is usually better to use a virtual con‐
19 trol, not requiring to add all the items to it at once, such as wx‐
20 DataViewCtrl (not implemented in wx) or wxListCtrl with wxLC_VIRTUAL
21 style, once more than a few hundreds items need to be displayed because
22 this control is not optimized, neither from performance nor from user
23 interface point of view, for large number of items.
24
25 Notice that the list box doesn't support control characters other than
26 TAB.
27
28 Styles
29
30 This class supports the following styles:
31
32 See: wxEditableListBox (not implemented in wx), wxChoice, wxComboBox,
33 wxListCtrl, wxCommandEvent
34
35 This class is derived (and can use functions) from: wxControlWithItems
36 wxControl wxWindow wxEvtHandler
37
38 wxWidgets docs: wxListBox
39
41 Event types emitted from this class: command_listbox_selected, com‐
42 mand_listbox_doubleclicked
43
45 wxListBox() = wx:wx_object()
46
48 new() -> wxListBox()
49
50 Default constructor.
51
52 new(Parent, Id) -> wxListBox()
53
54 Types:
55
56 Parent = wxWindow:wxWindow()
57 Id = integer()
58
59 new(Parent, Id, Options :: [Option]) -> wxListBox()
60
61 Types:
62
63 Parent = wxWindow:wxWindow()
64 Id = integer()
65 Option =
66 {pos, {X :: integer(), Y :: integer()}} |
67 {size, {W :: integer(), H :: integer()}} |
68 {choices, [unicode:chardata()]} |
69 {style, integer()} |
70 {validator, wx:wx_object()}
71
72 Constructor, creating and showing a list box.
73
74 See the other new/3 constructor; the only difference is that
75 this overload takes a wxArrayString (not implemented in wx) in‐
76 stead of a pointer to an array of wxString (not implemented in
77 wx).
78
79 destroy(This :: wxListBox()) -> ok
80
81 Destructor, destroying the list box.
82
83 create(This, Parent, Id, Pos, Size, Choices) -> boolean()
84
85 Types:
86
87 This = wxListBox()
88 Parent = wxWindow:wxWindow()
89 Id = integer()
90 Pos = {X :: integer(), Y :: integer()}
91 Size = {W :: integer(), H :: integer()}
92 Choices = [unicode:chardata()]
93
94 create(This, Parent, Id, Pos, Size, Choices, Options :: [Option]) ->
95 boolean()
96
97 Types:
98
99 This = wxListBox()
100 Parent = wxWindow:wxWindow()
101 Id = integer()
102 Pos = {X :: integer(), Y :: integer()}
103 Size = {W :: integer(), H :: integer()}
104 Choices = [unicode:chardata()]
105 Option = {style, integer()} | {validator, wx:wx_object()}
106
107 deselect(This, N) -> ok
108
109 Types:
110
111 This = wxListBox()
112 N = integer()
113
114 Deselects an item in the list box.
115
116 Remark: This applies to multiple selection listboxes only.
117
118 getSelections(This) -> Result
119
120 Types:
121
122 Result = {Res :: integer(), Selections :: [integer()]}
123 This = wxListBox()
124
125 Fill an array of ints with the positions of the currently se‐
126 lected items.
127
128 Return: The number of selections.
129
130 Remark: Use this with a multiple selection listbox.
131
132 See: wxControlWithItems:getSelection/1, wxControlWithItems:get‐
133 StringSelection/1, wxControlWithItems:setSelection/2
134
135 insertItems(This, Items, Pos) -> ok
136
137 Types:
138
139 This = wxListBox()
140 Items = [unicode:chardata()]
141 Pos = integer()
142
143 Insert the given number of strings before the specified posi‐
144 tion.
145
146 isSelected(This, N) -> boolean()
147
148 Types:
149
150 This = wxListBox()
151 N = integer()
152
153 Determines whether an item is selected.
154
155 Return: true if the given item is selected, false otherwise.
156
157 set(This, Items) -> ok
158
159 Types:
160
161 This = wxListBox()
162 Items = [unicode:chardata()]
163
164 Replaces the current control contents with the given items.
165
166 Notice that calling this method is usually much faster than ap‐
167 pending them one by one if you need to add a lot of items.
168
169 hitTest(This, Point) -> integer()
170
171 Types:
172
173 This = wxListBox()
174 Point = {X :: integer(), Y :: integer()}
175
176 Returns the item located at point, or wxNOT_FOUND if there is no
177 item located at point.
178
179 It is currently implemented for wxMSW, wxMac and wxGTK2 ports.
180
181 Return: Item located at point, or wxNOT_FOUND if unimplemented
182 or the item does not exist.
183
184 Since: 2.7.0
185
186 hitTest(This, X, Y) -> integer()
187
188 Types:
189
190 This = wxListBox()
191 X = Y = integer()
192
193 This is an overloaded member function, provided for convenience.
194 It differs from the above function only in what argument(s) it
195 accepts.
196
197 setFirstItem(This, N) -> ok
198
199 setFirstItem(This, String) -> ok
200
201 Types:
202
203 This = wxListBox()
204 String = unicode:chardata()
205
206 Set the specified item to be the first visible item.
207
208
209
210wxWidgets team. wx 2.2.1 wxListBox(3)