AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YDAT | YWAIT | Byzgraf | FAQs
MouseWheelEvent typedict
 
A MouseWheelEvent indicates that a mouse equipped with a wheel is being used and the wheel was rotated. The fields in a MouseWheelEvent are:
clickcount An int that is the number of mouse clicks associated with the event. The value stored in this field currently is system dependent, which means it should not be used for scrolling calculations.
coordinates A Point that indicates where the pointer was at the time of the event. The coordinates and location fields may or may not match, but coordinates should only be used by event handlers that are defined in drawable objects (i.e., components that define a graphics field). In that case coordinates will be the location of the pointer in the coordinate system described by the drawable object's graphics.CTM at the time the event arrived, otherwise coordinates and location will match. coordinates is ignored when a MouseWheelEvent is sent to another component using postEvent.
id An Object that must be an int or String, that identifies the type of this event. A value that is a String must be the name of an event handler that can process this event. A value that is an int must be a number that the yoix.event.HandlerID dictionary associates with an event handler that can process this event.

In practice, id is only used when you build an event that gets handed to postEvent, and in that case the value assigned to id is almost always a String.

location A Point that indicates where the pointer was at the time of the event. The point always describes a location in the component that requested the event in a coordinate system that has its origin at that component's upper left corner, positive x to the right, positive y down, and a resolution of 72 dots per inch.
modifiers An int that is a bitmask that tries to record the state of the mouse buttons and keyboard modifiers at the time of the event. Unfortunately, mouse button and keyboard modifier flags overlap (e.g., BUTTON2_MASK and ALT_MASK match), so modifiers can not record the state of all mouse buttons and keyboard modifiers, however reliable information about them is available in modifiersdown.

modifiers and modifiersdown use disjoint sets of bits as flags, so make sure you test modifiers using some combination of BUTTON1_MASK, BUTTON2_MASK, BUTTON3_MASK, SHIFT_MASK, CTRL_MASK, ALT_MASK, META_MASK, and ALT_GRAPH_MASK, which are defined in yoix.awt and yoix.swing. Also available are BUTTON_MASK and KEY_MASK, which are convenient combinations that can be used to test for any mouse button or any keyboard modifier.

modifiersdown An int that is a bitmask that represents the state of all keyboard modifiers and mouse buttons when the event occurred.

modifiersdown and modifiers use disjoint sets of bits as flags, so make sure you test modifiersdown using some combination of BUTTON1_DOWN_MASK, BUTTON2_DOWN_MASK, BUTTON3_DOWN_MASK, SHIFT_DOWN_MASK, CTRL_DOWN_MASK, ALT_DOWN_MASK, META_DOWN_MASK, and ALT_GRAPH_DOWN_MASK, which are defined in yoix.awt and yoix.swing. Also available are BUTTON_DOWN_MASK and KEY_DOWN_MASK, which are convenient combinations that can be used to test for any mouse button or any keyboard modifier.

popuptrigger An int that is 1 if the event represents the system dependent popup trigger, and 0 otherwise.
pressed An int that counts the number of mouse buttons that are pressed immediately after the event occurred.
scrollamount A platform dependent int that represents the number of units to scroll for each mouse wheel click recorded in wheelrotation when scrolltype is WHEEL_UNIT_SCROLL.
scrolltype A platform dependent int that represents the kind of scrolling that should take place in response to this event. The value should be WHEEL_UNIT_SCROLL or WHEEL_BLOCK_SCROLL, which are defined in yoix.awt and yoix.swing.
wheelrotation An int that records the number of mouse wheel clicks and the direction that the mouse wheel was rotated. A postive wheelrotation means the mouse wheel was rotated in one direction, a negative wheelrotation means it was rotated in the opposite direction, and the magnitude of wheelrotation is the number of mouse wheel clicks recorded by this event. When scrolltype is WHEEL_UNIT_SCROLL wheelrotation and scrollamount should be multiplied to determine how far to scroll.
when A double that is a timestamp that represents when the event occurred.
Most components can receive MouseWheelEvents, but they only arrive if the component has defined a mouseWheelMoved event handler.
 
 Example:   The program,
import yoix.*.*;

VM.exitmodel = 0;      // so main thread does not exit

JFrame frame = {
    mouseWheelMoved(Event e) {
        printf("mouseWheelMoved: %.2O\n", e);
        if (e.modifiers & SHIFT_MASK)
            exit(0);
    }
};

frame.visible = TRUE;

MouseWheelEvent event = {
    String id = "mouseWheelMoved";
    int    modifiers = BUTTON1_MASK;
    int    scrollamount = 3;
    int    wheelrotation = -5;
};

printf("Posting %s\n", event.id);
postEvent(event, frame);
prints
Posting mouseWheelMoved
mouseWheelMoved: Event[11:0]
    clickcount=0
    coordinates=Point[2:0]
       >x=0.0
        y=0.0
   >id=507
    location=Point[2:0]
       >x=0.0
        y=0.0
    modifiers=16
    popuptrigger=0
    pressed=1
    scrollamount=3
    scrolltype=0
    wheelrotation=-5
    when=0.0
on standard output and then dumps all real mouseWheelMoved events until the shift key is held down while the mouse wheel is rotated.
 
 See Also:   ActionEvent, AdjustmentEvent, CaretEvent, ChangeEvent, ComponentEvent, DragGestureEvent, DragSourceEvent, DropTargetEvent, Event, FocusEvent, HyperlinkEvent, InvocationEvent, invokeLater, isDispatchThread, ItemEvent, KeyEvent, ListSelectionEvent, MouseEvent, PaintEvent, postEvent, TextEvent, TreeSelectionEvent, WindowEvent

 

Yoix is a registered trademark of AT&T Intellectual Property.