Platforms to show: All Mac Windows Linux Cross-Platform

NSEventMonitorMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class Cocoa MBS MacFrameworks Plugin 12.4 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The class for watching events in Cocoa.
Example
// watch key presses in the application
// MyEventMonitor is a subclass of NSEventMonitorMBS with the LocalEvent event implemented.
// Monitor is a property of the app: Monitor As MyEventMonitor

Monitor = New MyEventMonitor
If Not Monitor.addLocalMonitorForEventsMatchingMask(NSEventMBS.NSKeyDownMask) Then
MessageBox "Failed to install monitor."
End If

// in MyEventMonitor:
Function LocalEvent(e As NSEventMBS) As NSEventMBS Handles LocalEvent
System.DebugLog "Key " + e.keyCode.ToString + ": " + e.characters
Return e // pass the event on, return Nil to swallow it
End Function

For Mac OS X 10.5 compatibility, please use CarbonMonitorEventsMBS class.

This class has no subclasses.

Blog Entries

Some examples using this class:

Some related classes:


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


NSEventMBS   -   NSExceptionHandlerMBS


The biggest plugin in space...