Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSEventMBS class.

NSEventMBS.doubleClickInterval as Double

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns the time, in seconds, in which a second mouse click must occur in order to be considered a double click.

This is a system setting, overriding this method will have no effect.
Available in Mac OS X v10.6 and later.

NSEventMBS.eventWithCGEvent(CGEventRef as Integer) as NSEventMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 18.2 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Creates and returns an event object that is based on a Core Graphics type of event.

The returned object retains the CGEventRef object (cgEvent) until it (the Xojo and Objective-C object) is freed—it then releases the CGEventRef object. If no Cocoa event corresponds to the CGEventRef object, this method returns nil.

NSEventMBS.isMouseCoalescingEnabled as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Indicates whether mouse-movement event coalescing is enabled.

Available in Mac OS X v10.5 and later.

NSEventMBS.keyEvent(Type as Integer, LocationX as Double, LocationY as Double, modifierFlags as Integer, timeStamp as double, windowNumber as Integer, characters as String, charactersIgnoringModifiers as String, isARepeat as boolean, keyCode as Integer) as NSEventMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 22.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns a new NSEventMBS object describing a key event.

type: One of the following event-type constants: NSKeyDown, NSKeyUp, NSFlagsChanged. If anything else is specified, an NSInternalInconsistencyException is raised.
location: The cursor location in the base coordinate system of the window specified by windowNum.
modifierFlags: An integer bit field containing any of the modifier key masks.
timeStamp: The time the event occurred in seconds since system startup.
windowNumber: An integer that identifies the window device associated with the event, which is associated with the NSWindow that will receive the event.
characters: A string of characters associated with the key event. Though most key events contain only one character, it is possible for a single keypress to generate a series of characters.
unmodCharacters: The string of characters generated by the key event as if no modifier key had been pressed (except for Shift). This argument is useful for getting the “basic” key value in a hardware-independent manner.
isARepeat: True if the key event is a repeat caused by the user holding the key down, false if the key event is new.
keyCode: A number that identifies the keyboard key associated with the key event. Its value is hardware-independent.

Returns the created NSEvent instance or nil if the instance could not be created.

NSEventMBS.keyRepeatDelay as Double

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns the length of time a key must be held down in order to generate the first key repeat event.

This is a system setting, overriding this method will have no effect.
Available in Mac OS X v10.6 and later.

NSEventMBS.keyRepeatInterval as Double

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns the length between subsequent key repeat events being posted.

This is a system setting, overriding this method will have no effect.
Available in Mac OS X v10.6 and later.

NSEventMBS.modifierFlagsGlobal as UInt32

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns the currently pressed modifier flags.

This returns the state of devices combined with synthesized events at the moment, independent of which events have been delivered via the event stream.
Available in Mac OS X v10.6 and later.

NSEventMBS.mouseEvent(Type as Integer, LocationX as Double, LocationY as Double, modifierFlags as Integer, timeStamp as double, windowNumber as Integer, eventNumber as Integer, clickCount as Integer, pressure as Single) as NSEventMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 22.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns a new NSEvent object describing a mouse-down, -up, -moved, or -dragged event.

type: One of the modifier key masks described in NSEventType, or an NSInternalInconsistencyException is raised.
location: The cursor location in the base coordinate system of the window specified by windowNumber.
flags: An integer bit field containing any of the modifier key masks described in Getting Unicode Values, combined using the C bitwise OR operator.
timeStamp: The time the event occurred in seconds since system startup.
windowNumber: An integer that identifies the window device associated with the event, which is associated with the NSWindow that will receive the event.
eventNumber: An identifier for the new event. It’s normally taken from a counter for mouse events, which continually increases as the application runs.
clickNumber: The number of mouse clicks associated with the mouse event.
pressure: A value from 0.0 to 1.0 indicating the pressure applied to the input device on a mouse event, used for an appropriate device such as a graphics tablet. For devices that aren’t pressure-sensitive, the value should be either 0.0 or 1.0.

Returns the created NSEventMBS instance or nil if the instance could not be created.

NSEventMBS.mouseLocation as NSPointMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 9.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Reports the current mouse position in screen coordinates.

This method is similar to the NSWindow method mouseLocationOutsideOfEventStream. It returns the location regardless of the current event or pending events. The difference between these methods is that mouseLocationOutsideOfEventStream returns a point in the receiving window's coordinates and mouseLocation returns the same information in screen coordinates.

Note: The y coordinate in the returned point starts from a base of 1, not 0.

Some examples using this method:

NSEventMBS.otherEvent(Type as Integer, LocationX as Double, LocationY as Double, modifierFlags as Integer, timeStamp as double, windowNumber as Integer, SubType as Integer, Data1 as Integer, Data2 as Integer) as NSEventMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 22.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns a new NSEventMBS object describing a custom event.

type: One of the following event-type constants: NSAppKitDefined, NSSystemDefined, NSApplicationDefined or NSPeriodic.
If type is anything else, an NSInternalInconsistencyException is raised. Your code should only create events of type NSApplicationDefined.
location: The cursor location in the base coordinate system of the window specified by windowNum.
flags: An integer bit field containing any of the modifier key masks.
time: The time the event occurred in seconds since system startup.
windowNumber: An integer that identifies the window device associated with the event, which is associated with the NSWindow that will receive the event.
subtype: A numeric identifier that further differentiates custom events of types NSAppKitDefined, NSSystemDefined, and NSApplicationDefined. NSPeriodic events don’t use this attribute.
data1: Additional data associated with the event. NSPeriodic events don’t use these attributes.
data2: Additional data associated with the event. NSPeriodic events don’t use these attributes.

Returns the created NSEvent object or nil if the object couldn't be created.

NSEventMBS.pressedMouseButtons as UInt32

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns the indices of the currently depressed mouse buttons.

The indices of the currently depressed mouse buttons.

A return value of 1 << 0 corresponds to left the mouse, 1 << 1 corresponds to the right mouse, 1<< n, n >=2 to other mouse buttons.

This returns the state of devices combined with synthesized events at the moment, independent of which events have been delivered via the event stream, so this method is not suitable for tracking.

Available in Mac OS X v10.6 and later.

NSEventMBS.setMouseCoalescingEnabled(Value as boolean)

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Whether mouse-movement event coalescing is enabled.

This method affects mouse-moved, mouse-dragged, and tablet events. Mouse-movement event coalescing is enabled by default.

Available in Mac OS X v10.5 and later.

The items on this page are in the following plugins: MBS MacBase Plugin.


The biggest plugin in space...