Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCF/Carbon Events/Hotkey Test
Required plugins for this example: MBS MacCF Plugin, MBS Main Plugin, MBS Util Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCF/Carbon Events/Hotkey Test
This example is the version from Sun, 17th Mar 2012.
Project "Hotkey Test.rbp"
Class Window1 Inherits Window
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control ListBox1 Inherits ListBox
ControlInstance ListBox1 Inherits ListBox
End Control
EventHandler Sub Open() const activeFlag = 1 const btnState = 128 const cmdKey = 256 const shiftKey = 512 const alphaLock = 1024 const optionKey = 2048 const controlKey = 4096 const rightShiftKey = 8192 const rightOptionKey = 16384 const rightControlKey = 32768 MyEvents1=new MyEvents MyEvents1.Listen p=new CarbonHotKeyMBS p.AddKey(&h24, optionKey+shiftKey, OSTypeFromStringMBS("MBSG"), 5) if p.LastError<>0 then MsgBox "The Hotkey could not be registered!" end if // key will be released when p is destroyed on closing the window. End EventHandler
Property Protected MyEvents1 As myEvents
Property Protected p As CarbonHotKeyMBS
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class MyEvents Inherits CarbonApplicationEventsMBS
EventHandler Sub HotKeyPressed(signature as integer, id as integer) Window1.ListBox1.AddRow "Hotkey pressed" Window1.CollapsedMBS=not Window1.CollapsedMBS End EventHandler
EventHandler Sub HotKeyReleased(signature as integer, id as integer) Window1.ListBox1.AddRow "Hotkey released" End EventHandler
End Class
Class App Inherits Application
End Class
End Project

See also:

Feedback, Comments & Corrections

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

MBS FileMaker Plugins