Migration Guide > Migration Guide > I. Features Introduced in OpenROAD 6.2 > New Features > MouseData Class and New Mouse Events Added
Was this helpful?
MouseData Class and New Mouse Events Added
The MouseData class contains information about the mouse that caused a MouseDown, ChildMouseDown, MouseUp, or ChildMouseUp event.
These events are not queued; instead, the OpenROAD runtime generates them immediately. Therefore, they fire before any future OpenROAD events occur from the same system event such as Click events, which can occur only after some WM_LBUTTONUP system events. OpenROAD events such as KeyDown and SliderMove behave similarly.
You may discard further processing of a WM_LBUTTONDOWN, WM_MBUTTONDDOWN, or WM_RBUTTONDOWN message. OpenROAD then ignores the corresponding WM_LBUTTONUP, WM_MBUTTONUP, or WM_RBUTTONUP event that generates an abstract OpenROAD 4GL event such as a Click event; however, the corresponding MouseUp OpenROAD 4GL event will occur for you to catch. You can signal that the event should be terminated by setting the CancelEvent attribute to a non-zero value.
Reason code system constant settings enable you to identify which mouse button—MS_LEFT, MS_RIGHT, or MS_MIDDLE—triggers the event. For more information, see For the ChildMouseDown, MouseDown, ChildMouseUp, and MouseUp Events.
MouseData has the following attributes:
CancelEvent
Data Type: integer
4GL Access: RW
You can intercept a mouse down message and prevent further processing of a WM_LBUTTONDOWN, WM_MBUTTONDOWN, or WM_RBUTTONDOWN message by setting the CancelEvent attribute to TRUE in the MouseDown or ChildMouseDown event block.
KeyModifiers
Data Type: integer
4GL Access: R
The KeyModifiers attribute indicates which modifier keys are pressed at the time of the MouseDown or ChildMouseDown event. The value of the KeyModifiers attribute enables you to determine whether the key is modified by the Shift, Ctrl, or Alt keys; it also lets you distinguish between the left and right modifier keys. This attribute contains bits that indicate which modifier keys are pressed. Three bits indicate the state of the modifier keys without distinguishing between the left and right keys; six bits let you determine the state of the left and right modifier keys.
TimeStamp
Data Type: integer8
4GL Access: R
The TimeStamp attribute contains the date and time of the mouse event occurrence.
WidgetID
Data Type: integer
4GL Access: R
The WidgetID attribute represents the system handle of the window associated with this system event, usually the TriggerField.
XPixel
Data Type: integer
4GL Access: R
Specifies the X-coordinate of the mouse, in pixels, relative to the TriggerField.
XPixelScreen
Data Type: integer
4GL Access: R
Specifies the X-coordinate of the mouse, in pixels, relative to the screen.
YPixel
Data Type: integer
4GL Access: R
Specifies the Y-coordinate of the mouse, in pixels, relative to the TriggerField.
YPixelScreen
Data Type: integer
4GL Access: R
Specifies the Y-coordinate of the mouse, in pixels, relative to the screen.
The following new events are added to capture mouse actions. None of these events is queued, but generate and fire immediately.
ChildMouseDown
The ChildMouseDown event triggers whenever OpenROAD receives a WM_LBUTTONDOWN, WM_MBUTTONDDOWN, or WM_RBUTTONDOWN message. Information about the state of the mouse is stored in a MouseData object delivered to the 4GL program in the MessageObject of the FrameExec class.
ChildMouseUp
The ChildMouseUp event triggers whenever OpenROAD receives a WM_LBUTTONUP, WM_MBUTTONUP, or WM_RBUTTONUP message. Information about the state of the mouse is stored in a MouseData object delivered to the 4GL program in the MessageObject of the GhostExec class.
MouseDown
The MouseDown event triggers whenever OpenROAD receives a WM_LBUTTONDOWN, WM_MBUTTONDDOWN, or WM_RBUTTONDOWN message. Information about the state of the mouse is stored in a MouseData object delivered to the 4GL program in the MessageObject of the FrameExec class.
MouseUp
The MouseUp event triggers whenever OpenROAD receives a WM_LBUTTONUP, WM_MBUTTONUP, or WM_RBUTTONUP message. Information about the state of the mouse is stored in a MouseData object delivered to the 4GL program in the MessageObject of the FrameExec class.
The following reason codes are added:
RC_MOUSELEFT
RC_MOUSELEFTDOUBLECLICK
RC_MOUSEMIDDLE
RC_MOUSEMIDDLEDOUBLECLICK
RC_MOUSERIGHT
RC_MOUSERIGHTDOUBLECLICK
For numeric equivalents of these system constants, see For the ChildMouseDown, MouseDown, ChildMouseUp, and MouseUp Events.
For more information about the MouseData class and mouse events, see the Language Reference Guide.
Last modified date: 06/25/2024