1wxMouseEvent(3) Erlang Module Definition wxMouseEvent(3)
2
3
4
6 wxMouseEvent - Functions for wxMouseEvent class
7
9 This event class contains information about the events generated by the
10 mouse: they include mouse buttons press and release events and mouse
11 move events.
12
13 All mouse events involving the buttons use wxMOUSE_BTN_LEFT for the
14 left mouse button, wxMOUSE_BTN_MIDDLE for the middle one and wx‐
15 MOUSE_BTN_RIGHT for the right one. And if the system supports more but‐
16 tons, the wxMOUSE_BTN_AUX1 and wxMOUSE_BTN_AUX2 events can also be gen‐
17 erated. Note that not all mice have even a middle button so a portable
18 application should avoid relying on the events from it (but the right
19 button click can be emulated using the left mouse button with the con‐
20 trol key under Mac platforms with a single button mouse).
21
22 For the wxEVT_ENTER_WINDOW and wxEVT_LEAVE_WINDOW events purposes, the
23 mouse is considered to be inside the window if it is in the window
24 client area and not inside one of its children. In other words, the
25 parent window receives wxEVT_LEAVE_WINDOW event not only when the mouse
26 leaves the window entirely but also when it enters one of its children.
27
28 The position associated with a mouse event is expressed in the window
29 coordinates of the window which generated the event, you can use wxWin‐
30 dow:clientToScreen/3 to convert it to screen coordinates and possibly
31 call wxWindow:screenToClient/2 next to convert it to window coordinates
32 of another window.
33
34 Note: Note the difference between methods like leftDown/1 and the in‐
35 herited leftIsDown/1: the former returns true when the event corre‐
36 sponds to the left mouse button click while the latter returns true if
37 the left mouse button is currently being pressed. For example, when the
38 user is dragging the mouse you can use leftIsDown/1 to test whether the
39 left mouse button is (still) depressed. Also, by convention, if left‐
40 Down/1 returns true, leftIsDown/1 will also return true in wxWidgets
41 whatever the underlying GUI behaviour is (which is platform-dependent).
42 The same applies, of course, to other mouse buttons as well.
43
44 See: wxKeyEvent
45
46 This class is derived (and can use functions) from: wxEvent
47
48 wxWidgets docs: wxMouseEvent
49
51 Use wxEvtHandler:connect/3 with wxMouseEventType to subscribe to events
52 of this type.
53
55 wxMouseEvent() = wx:wx_object()
56
57 wxMouse() =
58 #wxMouse{type = wxMouseEvent:wxMouseEventType(),
59 x = integer(),
60 y = integer(),
61 leftDown = boolean(),
62 middleDown = boolean(),
63 rightDown = boolean(),
64 controlDown = boolean(),
65 shiftDown = boolean(),
66 altDown = boolean(),
67 metaDown = boolean(),
68 wheelRotation = integer(),
69 wheelDelta = integer(),
70 linesPerAction = integer()}
71
72 wxMouseEventType() =
73 left_down | left_up | middle_down | middle_up | right_down |
74 right_up | motion | enter_window | leave_window |
75 left_dclick | middle_dclick | right_dclick | mousewheel |
76 aux1_down | aux1_up | aux1_dclick | aux2_down | aux2_up |
77 aux2_dclick
78
80 altDown(This) -> boolean()
81
82 Types:
83
84 This = wxMouseEvent()
85
86 Returns true if the Alt key is pressed.
87
88 Notice that wxKeyEvent:getModifiers/1 should usually be used in‐
89 stead of this one.
90
91 button(This, But) -> boolean()
92
93 Types:
94
95 This = wxMouseEvent()
96 But = wx:wx_enum()
97
98 Returns true if the event was generated by the specified button.
99
100 See: wxMouseState::ButtoinIsDown()
101
102 buttonDClick(This) -> boolean()
103
104 Types:
105
106 This = wxMouseEvent()
107
108 buttonDClick(This, Options :: [Option]) -> boolean()
109
110 Types:
111
112 This = wxMouseEvent()
113 Option = {but, wx:wx_enum()}
114
115 If the argument is omitted, this returns true if the event was a
116 mouse double click event.
117
118 Otherwise the argument specifies which double click event was
119 generated (see button/2 for the possible values).
120
121 buttonDown(This) -> boolean()
122
123 Types:
124
125 This = wxMouseEvent()
126
127 buttonDown(This, Options :: [Option]) -> boolean()
128
129 Types:
130
131 This = wxMouseEvent()
132 Option = {but, wx:wx_enum()}
133
134 If the argument is omitted, this returns true if the event was a
135 mouse button down event.
136
137 Otherwise the argument specifies which button-down event was
138 generated (see button/2 for the possible values).
139
140 buttonUp(This) -> boolean()
141
142 Types:
143
144 This = wxMouseEvent()
145
146 buttonUp(This, Options :: [Option]) -> boolean()
147
148 Types:
149
150 This = wxMouseEvent()
151 Option = {but, wx:wx_enum()}
152
153 If the argument is omitted, this returns true if the event was a
154 mouse button up event.
155
156 Otherwise the argument specifies which button-up event was gen‐
157 erated (see button/2 for the possible values).
158
159 cmdDown(This) -> boolean()
160
161 Types:
162
163 This = wxMouseEvent()
164
165 Returns true if the key used for command accelerators is
166 pressed.
167
168 Same as controlDown/1. Deprecated.
169
170 Notice that wxKeyEvent:getModifiers/1 should usually be used in‐
171 stead of this one.
172
173 controlDown(This) -> boolean()
174
175 Types:
176
177 This = wxMouseEvent()
178
179 Returns true if the Control key or Apple/Command key under macOS
180 is pressed.
181
182 This function doesn't distinguish between right and left control
183 keys.
184
185 Notice that wxKeyEvent:getModifiers/1 should usually be used in‐
186 stead of this one.
187
188 dragging(This) -> boolean()
189
190 Types:
191
192 This = wxMouseEvent()
193
194 Returns true if this was a dragging event (motion while a button
195 is depressed).
196
197 See: moving/1
198
199 entering(This) -> boolean()
200
201 Types:
202
203 This = wxMouseEvent()
204
205 Returns true if the mouse was entering the window.
206
207 See: leaving/1
208
209 getButton(This) -> integer()
210
211 Types:
212
213 This = wxMouseEvent()
214
215 Returns the mouse button which generated this event or wx‐
216 MOUSE_BTN_NONE if no button is involved (for mouse move, enter
217 or leave event, for example).
218
219 Otherwise wxMOUSE_BTN_LEFT is returned for the left button down,
220 up and double click events, wxMOUSE_BTN_MIDDLE and wx‐
221 MOUSE_BTN_RIGHT for the same events for the middle and the right
222 buttons respectively.
223
224 getPosition(This) -> {X :: integer(), Y :: integer()}
225
226 Types:
227
228 This = wxMouseEvent()
229
230 Returns the physical mouse position.
231
232 getLogicalPosition(This, Dc) -> {X :: integer(), Y :: integer()}
233
234 Types:
235
236 This = wxMouseEvent()
237 Dc = wxDC:wxDC()
238
239 Returns the logical mouse position in pixels (i.e. translated
240 according to the translation set for the DC, which usually indi‐
241 cates that the window has been scrolled).
242
243 getLinesPerAction(This) -> integer()
244
245 Types:
246
247 This = wxMouseEvent()
248
249 Returns the configured number of lines (or whatever) to be
250 scrolled per wheel action.
251
252 Default value under most platforms is three.
253
254 See: GetColumnsPerAction() (not implemented in wx)
255
256 getWheelRotation(This) -> integer()
257
258 Types:
259
260 This = wxMouseEvent()
261
262 Get wheel rotation, positive or negative indicates direction of
263 rotation.
264
265 Current devices all send an event when rotation is at least
266 +/-WheelDelta, but finer resolution devices can be created in
267 the future.
268
269 Because of this you shouldn't assume that one event is equal to
270 1 line, but you should be able to either do partial line
271 scrolling or wait until several events accumulate before
272 scrolling.
273
274 getWheelDelta(This) -> integer()
275
276 Types:
277
278 This = wxMouseEvent()
279
280 Get wheel delta, normally 120.
281
282 This is the threshold for action to be taken, and one such ac‐
283 tion (for example, scrolling one increment) should occur for
284 each delta.
285
286 getX(This) -> integer()
287
288 Types:
289
290 This = wxMouseEvent()
291
292 Returns X coordinate of the physical mouse event position.
293
294 getY(This) -> integer()
295
296 Types:
297
298 This = wxMouseEvent()
299
300 Returns Y coordinate of the physical mouse event position.
301
302 isButton(This) -> boolean()
303
304 Types:
305
306 This = wxMouseEvent()
307
308 Returns true if the event was a mouse button event (not neces‐
309 sarily a button down event - that may be tested using button‐
310 Down/2).
311
312 isPageScroll(This) -> boolean()
313
314 Types:
315
316 This = wxMouseEvent()
317
318 Returns true if the system has been setup to do page scrolling
319 with the mouse wheel instead of line scrolling.
320
321 leaving(This) -> boolean()
322
323 Types:
324
325 This = wxMouseEvent()
326
327 Returns true if the mouse was leaving the window.
328
329 See: entering/1
330
331 leftDClick(This) -> boolean()
332
333 Types:
334
335 This = wxMouseEvent()
336
337 Returns true if the event was a left double click.
338
339 leftDown(This) -> boolean()
340
341 Types:
342
343 This = wxMouseEvent()
344
345 Returns true if the left mouse button changed to down.
346
347 leftIsDown(This) -> boolean()
348
349 Types:
350
351 This = wxMouseEvent()
352
353 Returns true if the left mouse button is currently down.
354
355 leftUp(This) -> boolean()
356
357 Types:
358
359 This = wxMouseEvent()
360
361 Returns true if the left mouse button changed to up.
362
363 metaDown(This) -> boolean()
364
365 Types:
366
367 This = wxMouseEvent()
368
369 Returns true if the Meta key was down at the time of the event.
370
371 middleDClick(This) -> boolean()
372
373 Types:
374
375 This = wxMouseEvent()
376
377 Returns true if the event was a middle double click.
378
379 middleDown(This) -> boolean()
380
381 Types:
382
383 This = wxMouseEvent()
384
385 Returns true if the middle mouse button changed to down.
386
387 middleIsDown(This) -> boolean()
388
389 Types:
390
391 This = wxMouseEvent()
392
393 Returns true if the middle mouse button is currently down.
394
395 middleUp(This) -> boolean()
396
397 Types:
398
399 This = wxMouseEvent()
400
401 Returns true if the middle mouse button changed to up.
402
403 moving(This) -> boolean()
404
405 Types:
406
407 This = wxMouseEvent()
408
409 Returns true if this was a motion event and no mouse buttons
410 were pressed.
411
412 If any mouse button is held pressed, then this method returns
413 false and dragging/1 returns true.
414
415 rightDClick(This) -> boolean()
416
417 Types:
418
419 This = wxMouseEvent()
420
421 Returns true if the event was a right double click.
422
423 rightDown(This) -> boolean()
424
425 Types:
426
427 This = wxMouseEvent()
428
429 Returns true if the right mouse button changed to down.
430
431 rightIsDown(This) -> boolean()
432
433 Types:
434
435 This = wxMouseEvent()
436
437 Returns true if the right mouse button is currently down.
438
439 rightUp(This) -> boolean()
440
441 Types:
442
443 This = wxMouseEvent()
444
445 Returns true if the right mouse button changed to up.
446
447 shiftDown(This) -> boolean()
448
449 Types:
450
451 This = wxMouseEvent()
452
453 Returns true if the Shift key is pressed.
454
455 This function doesn't distinguish between right and left shift
456 keys.
457
458 Notice that wxKeyEvent:getModifiers/1 should usually be used in‐
459 stead of this one.
460
461 getWheelAxis(This) -> wx:wx_enum()
462
463 Types:
464
465 This = wxMouseEvent()
466
467 Gets the axis the wheel operation concerns.
468
469 Usually the mouse wheel is used to scroll vertically so wx‐
470 MOUSE_WHEEL_VERTICAL is returned but some mice (and most track‐
471 pads) also allow to use the wheel to scroll horizontally in
472 which case wxMOUSE_WHEEL_HORIZONTAL is returned.
473
474 Notice that before wxWidgets 2.9.4 this method returned int.
475
476 aux1DClick(This) -> boolean()
477
478 Types:
479
480 This = wxMouseEvent()
481
482 Returns true if the event was a first extra button double click.
483
484 aux1Down(This) -> boolean()
485
486 Types:
487
488 This = wxMouseEvent()
489
490 Returns true if the first extra button mouse button changed to
491 down.
492
493 aux1Up(This) -> boolean()
494
495 Types:
496
497 This = wxMouseEvent()
498
499 Returns true if the first extra button mouse button changed to
500 up.
501
502 aux2DClick(This) -> boolean()
503
504 Types:
505
506 This = wxMouseEvent()
507
508 Returns true if the event was a second extra button double
509 click.
510
511 aux2Down(This) -> boolean()
512
513 Types:
514
515 This = wxMouseEvent()
516
517 Returns true if the second extra button mouse button changed to
518 down.
519
520 aux2Up(This) -> boolean()
521
522 Types:
523
524 This = wxMouseEvent()
525
526 Returns true if the second extra button mouse button changed to
527 up.
528
529
530
531wxWidgets team. wx 2.2.2 wxMouseEvent(3)