1wxUpdateUIEvent(3) Erlang Module Definition wxUpdateUIEvent(3)
2
3
4
6 wxUpdateUIEvent - Functions for wxUpdateUIEvent class
7
9 This class is used for pseudo-events which are called by wxWidgets to
10 give an application the chance to update various user interface ele‐
11 ments.
12
13 Without update UI events, an application has to work hard to
14 check/uncheck, enable/disable, show/hide, and set the text for elements
15 such as menu items and toolbar buttons. The code for doing this has to
16 be mixed up with the code that is invoked when an action is invoked for
17 a menu item or button.
18
19 With update UI events, you define an event handler to look at the state
20 of the application and change UI elements accordingly. wxWidgets will
21 call your member functions in idle time, so you don't have to worry
22 where to call this code.
23
24 In addition to being a clearer and more declarative method, it also
25 means you don't have to worry whether you're updating a toolbar or
26 menubar identifier. The same handler can update a menu item and toolbar
27 button, if the identifier is the same. Instead of directly manipulating
28 the menu or button, you call functions in the event object, such as
29 check/2. wxWidgets will determine whether such a call has been made,
30 and which UI element to update.
31
32 These events will work for popup menus as well as menubars. Just before
33 a menu is popped up, wxMenu::UpdateUI (not implemented in wx) is called
34 to process any UI events for the window that owns the menu.
35
36 If you find that the overhead of UI update processing is affecting your
37 application, you can do one or both of the following:
38
39 Note that although events are sent in idle time, defining a wxIdleEvent
40 handler for a window does not affect this because the events are sent
41 from wxWindow::OnInternalIdle (not implemented in wx) which is always
42 called in idle time.
43
44 wxWidgets tries to optimize update events on some platforms. On Windows
45 and GTK+, events for menubar items are only sent when the menu is about
46 to be shown, and not in idle time.
47
48 See: Overview events
49
50 This class is derived (and can use functions) from: wxCommandEvent wx‐
51 Event
52
53 wxWidgets docs: wxUpdateUIEvent
54
56 Use wxEvtHandler:connect/3 with wxUpdateUIEventType to subscribe to
57 events of this type.
58
60 wxUpdateUIEvent() = wx:wx_object()
61
62 wxUpdateUI() =
63 #wxUpdateUI{type = wxUpdateUIEvent:wxUpdateUIEventType()}
64
65 wxUpdateUIEventType() = update_ui
66
68 canUpdate(Window) -> boolean()
69
70 Types:
71
72 Window = wxWindow:wxWindow()
73
74 Returns true if it is appropriate to update (send UI update
75 events to) this window.
76
77 This function looks at the mode used (see setMode/1), the
78 wxWS_EX_PROCESS_UI_UPDATES flag in window, the time update
79 events were last sent in idle time, and the update interval, to
80 determine whether events should be sent to this window now. By
81 default this will always return true because the update mode is
82 initially wxUPDATE_UI_PROCESS_ALL and the interval is set to 0;
83 so update events will be sent as often as possible. You can re‐
84 duce the frequency that events are sent by changing the mode
85 and/or setting an update interval.
86
87 See: resetUpdateTime/0, setUpdateInterval/1, setMode/1
88
89 check(This, Check) -> ok
90
91 Types:
92
93 This = wxUpdateUIEvent()
94 Check = boolean()
95
96 Check or uncheck the UI element.
97
98 enable(This, Enable) -> ok
99
100 Types:
101
102 This = wxUpdateUIEvent()
103 Enable = boolean()
104
105 Enable or disable the UI element.
106
107 show(This, Show) -> ok
108
109 Types:
110
111 This = wxUpdateUIEvent()
112 Show = boolean()
113
114 Show or hide the UI element.
115
116 getChecked(This) -> boolean()
117
118 Types:
119
120 This = wxUpdateUIEvent()
121
122 Returns true if the UI element should be checked.
123
124 getEnabled(This) -> boolean()
125
126 Types:
127
128 This = wxUpdateUIEvent()
129
130 Returns true if the UI element should be enabled.
131
132 getShown(This) -> boolean()
133
134 Types:
135
136 This = wxUpdateUIEvent()
137
138 Returns true if the UI element should be shown.
139
140 getSetChecked(This) -> boolean()
141
142 Types:
143
144 This = wxUpdateUIEvent()
145
146 Returns true if the application has called check/2.
147
148 For wxWidgets internal use only.
149
150 getSetEnabled(This) -> boolean()
151
152 Types:
153
154 This = wxUpdateUIEvent()
155
156 Returns true if the application has called enable/2.
157
158 For wxWidgets internal use only.
159
160 getSetShown(This) -> boolean()
161
162 Types:
163
164 This = wxUpdateUIEvent()
165
166 Returns true if the application has called show/2.
167
168 For wxWidgets internal use only.
169
170 getSetText(This) -> boolean()
171
172 Types:
173
174 This = wxUpdateUIEvent()
175
176 Returns true if the application has called setText/2.
177
178 For wxWidgets internal use only.
179
180 getText(This) -> unicode:charlist()
181
182 Types:
183
184 This = wxUpdateUIEvent()
185
186 Returns the text that should be set for the UI element.
187
188 getMode() -> wx:wx_enum()
189
190 Static function returning a value specifying how wxWidgets will
191 send update events: to all windows, or only to those which spec‐
192 ify that they will process the events.
193
194 See: setMode/1
195
196 getUpdateInterval() -> integer()
197
198 Returns the current interval between updates in milliseconds.
199
200 The value -1 disables updates, 0 updates as frequently as possi‐
201 ble.
202
203 See: setUpdateInterval/1
204
205 resetUpdateTime() -> ok
206
207 Used internally to reset the last-updated time to the current
208 time.
209
210 It is assumed that update events are normally sent in idle time,
211 so this is called at the end of idle processing.
212
213 See: canUpdate/1, setUpdateInterval/1, setMode/1
214
215 setMode(Mode) -> ok
216
217 Types:
218
219 Mode = wx:wx_enum()
220
221 Specify how wxWidgets will send update events: to all windows,
222 or only to those which specify that they will process the
223 events.
224
225 setText(This, Text) -> ok
226
227 Types:
228
229 This = wxUpdateUIEvent()
230 Text = unicode:chardata()
231
232 Sets the text for this UI element.
233
234 setUpdateInterval(UpdateInterval) -> ok
235
236 Types:
237
238 UpdateInterval = integer()
239
240 Sets the interval between updates in milliseconds.
241
242 Set to -1 to disable updates, or to 0 to update as frequently as
243 possible. The default is 0.
244
245 Use this to reduce the overhead of UI update events if your ap‐
246 plication has a lot of windows. If you set the value to -1 or
247 greater than 0, you may also need to call wxWindow:updateWin‐
248 dowUI/2 at appropriate points in your application, such as when
249 a dialog is about to be shown.
250
251
252
253wxWidgets team. wx 2.3.1 wxUpdateUIEvent(3)