Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/MacFrameworks/Event Logging
Function:
Required plugins for this example: MBS MacBase Plugin, MBS MacCF Plugin, MBS MacFrameworks Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacFrameworks/Event Logging
This example is the version from Sat, 7th Mar 2014.
Project "Event Logging.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
EventHandler Sub Open() if not m.Available then MsgBox "This functionality needs Mac OS X 10.6." quit end if m = new MyNSEventMonitor call m.addLocalMonitorForEventsMatchingMask(NSEventMBS.NSAnyEventMask) call m.addGlobalMonitorForEventsMatchingMask(NSEventMBS.NSAnyEventMask) window1.List.AddRow "Trusted: "+str(AccessibilityMBS.IsProcessTrusted) End EventHandler
Property m As MyNSEventMonitor
End Class
Class Window1 Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
Control TextField1 Inherits TextField
ControlInstance TextField1 Inherits TextField
End Control
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
Class MyNSEventMonitor Inherits NSEventMonitorMBS
EventHandler Sub GlobalEvent(e as NSEventMBS) window1.List.AddRow "Global: "+e.description window1.List.ScrollPosition = window1.List.ListCount End EventHandler
EventHandler Function LocalEvent(e as NSEventMBS) As NSEventMBS window1.List.AddRow "Local: "+e.description window1.List.ScrollPosition = window1.List.ListCount // Return nil to block event Finally // Return event, because else your app can't do anything Return e End EventHandler
End Class
End Project

Feedback, Comments & Corrections

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




Links
MBS Xojo tutorial videos