The OpenD Programming Language

MouseOutEvent

Indicates that the user has worked with the mouse over your widget. For available properties, see MouseEventBase.

More...
class MouseOutEvent : Event {}

Members

Manifest constants

EventString
enum EventString;

Inherited Members

From Event

getPropertiesList
void getPropertiesList(void delegate(string name) sink)
getPropertyAsString
void getPropertyAsString(string name, void delegate(string name, scope const(char)[] value, bool valueIsJson) sink)
setPropertyFromString
SetPropertyResult setPropertyFromString(string name, const(char)[] str, bool strIsJson)

Implementations for the ReflectableProperties interface/

propagates
bool propagates()

Events should generally follow the propagation model, but there's some exceptions to that rule. If so, they should override this to return false. In that case, only bubbling event handlers on the target itself and capturing event handlers on the containing window will be called. (That is, dispatch will call sendDirectly instead of doing the normal capture -> target -> bubble process.)

cancelable
bool cancelable()

hints as to whether preventDefault will actually do anything. not entirely reliable.

Register
mixintemplate Register()

You can mix this into child class to register some boilerplate. It includes the EventString member, a constructor, and implementations of the dynamic get data interfaces.

source
Widget source;
target
alias target = source
srcElement
alias srcElement = source

This is the widget that emitted the event.

relatedTarget
Widget relatedTarget;

Note: likely to be deprecated at some point.

preventDefault
void preventDefault()

Prevents the default event handler (if there is one) from being called

stopPropagation
void stopPropagation()

Stops the event propagation immediately.

adjustScrolling
void adjustScrolling()
adjustClientCoordinates
void adjustClientCoordinates(int deltaX, int deltaY)

This is an internal implementation detail you should not use. It would be private if the language allowed it and it may be removed without notice.

sendDirectly
void sendDirectly()

this sends it only to the target. If you want propagation, use dispatch() instead.

dispatch
void dispatch()

this dispatches the element using the capture -> target -> bubble process

intValue
int intValue [@property getter]
stringValue
string stringValue [@property getter]

Detailed Description

Important: MouseDownEvent, MouseUpEvent, ClickEvent, and DoubleClickEvent are all sent for all mouse buttons and for wheel movement! You should check the button property in most your handlers to get correct behavior.

MouseDownEvent is sent when the user presses a mouse button. It is also sent on mouse wheel movement.

MouseUpEvent is sent when the user releases a mouse button.

MouseMoveEvent is sent when the mouse is moved. Please note you may not receive this in some cases unless a button is also pressed; the system is free to withhold them as an optimization. (In practice, arsd.simpledisplay does not request mouse motion event without a held button if it is on a remote X11 link, but does elsewhere at this time.)

ClickEvent is sent when the user clicks on the widget. It may also be sent with keyboard control, though minigui prefers to send a "triggered" event in addition to a mouse click and instead of a simulated mouse click in cases like keyboard activation of a button.

DoubleClickEvent is sent when the user clicks twice on a thing quickly, immediately after the second MouseDownEvent. The sequence is: MouseDownEvent, MouseUpEvent, ClickEvent, MouseDownEvent, DoubleClickEvent, MouseUpEvent. The second ClickEvent is NOT sent. Note that this is differnet than Javascript! They would send down,up,click,down,up,click,dblclick. Minigui does it differently because this is the way the Windows OS reports it.

MouseOverEvent is sent then the mouse first goes over a widget. Please note that this participates in event propagation of children! Use MouseEnterEvent instead if you are only interested in a specific element's whole bounding box instead of the top-most element in any particular location.

MouseOutEvent is sent when the mouse exits a target. Please note that this participates in event propagation of children! Use MouseLeaveEvent instead if you are only interested in a specific element's whole bounding box instead of the top-most element in any particular location.

MouseEnterEvent is sent when the mouse enters the bounding box of a widget.

MouseLeaveEvent is sent when the mouse leaves the bounding box of a widget.

You can construct these yourself, but generally the system will send them to you and there's little need to emit your own.

Rationale:

If you only want to do drag, mousedown/up works just fine being consistently sent.

If you want click, that event does what you expect (if the user mouse downs then moves the mouse off the widget before going up, no click event happens - a click is only down and back up on the same thing).

If you want double click and listen to that specifically, it also just works, and if you only cared about clicks, odds are the double click should do the same thing as a single click anyway - the double was prolly accidental - so only sending the event once is prolly what user intended.

Meta

History

Added May 2, 2021. Previously, it was only seen as the base Event class on event listeners. See the member EventString to see what the associated string is with these elements.