| Did you know ... | Search Documentation: |
| event-id |
<-key.
Whether or not an event is of specified type is normally tested using
event->is_a.
Other useful classifications are realised using
event->is_up, event->is_down, event->is_drag, event->has_modifier, event<-click_time
and
event<-click_displacement.
One event requires special treatment. This is the event related to wheel-mice,
mice normally having two buttons and a scroll-wheel. Rotations of the
scroll-wheel are mapped to an
event object with event<-id:
wheel. The rotation is available as
event<-rotation, which is @nil
for all other events. A notch of the wheel is a rotation of 15 degrees.
The value is positive if the wheel is rotated from the user and negative
when rotated towards the user.
In the X11 version, wheel-events are normally mapped to the virtual
mouse-buttons 4 and 5. If the class-variable
event.x11_wheel_mouse = @on
(default in the X11 version), the low-level event handling will map the
button 4 and button 5 events to wheel events.
Horizontal scrolling, e.g., using a
trackpad or tilting the wheel, is mapped to an event with event<-id:
horizontal_wheel. Its event<-rotation is
positive to the right. If a trackpad scrolls diagonally, the event
reports the dominant direction.
The event<-detail
of both events is a wheel_data
object that holds the precise scroll distance in both directions, so a
handler may use
get(Ev, dx, DX) and get(Ev, dy, DY) for smooth
scrolling.
In a window with window<->smooth_scroll @on,
the event<-rotation may be a fraction of a
notch. See there.
The wheel event is handled by class window, class editor, class list_browser and class scroll_bar. The wheel scrolls vertically, a page if Control is held down. As usual, the wheel with Shift held down scrolls horizontally, as does the wheel on a horizontal scroll_bar. If the receiver cannot scroll horizontally, Shift scrolls one line.
->is_a