Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

MediaKeysMBS class

Type Topic Plugin Version macOS Windows Linux Console & Web iOS
class Media Keys MBS MacFrameworks Plugin 11.2 Yes No No Yes, macOS only No
Function: Catch some special keys with this class.
dim m as MediaKeysMBS // global property!

// app initialization
m = new MediaKeysMBS

// set which keys to watch for
m.Keys(MediaKeysMBS.kMediaKeyEject) = MediaKeysMBS.kModeEventAndBlock

// and start
First written to catch play, fast and rewind keys from Apple keyboards.
Later extended to also catch other keys.
Still not all keys are available on all keyboards.

Please have only instance of this class running your application.

Feedback, Comments & Corrections

Key Constants

Constant Value Description
kMediaKeyBrightnessDown 3
kMediaKeyBrightnessUp 2
kMediaKeyCapsLock 4 Caps Lock
kMediaKeyContrastDown 12
kMediaKeyContrastUp 11
kMediaKeyDownArrow 9
kMediaKeyEject 14 Eject key
kMediaKeyFast 19 Fast key. On by default.
kMediaKeyHelp 5
kMediaKeyIlluminationDown 22
kMediaKeyIlluminationToggle 23
kMediaKeyIlluminationUp 21
kMediaKeyLaunchPanel 13
kMediaKeyMute 7 Sound Mute
kMediaKeyNext 17
kMediaKeyNumLock 10 Num Lock key
kMediaKeyPlay 16 Play key. On by default.
kMediaKeyPower 6 Power Key
kMediaKeyPrevious 18 Previous key
kMediaKeyRewind 20 Rewind Key. On by default.
kMediaKeySoundDown 1 Sound down
kMediaKeySoundUp 0 Sound up
kMediaKeyUpArrow 8
kMediaKeyVideoMirror 15

Mode Constants

Constant Value Description
kModeBlock 1 Block the event.
kModeEventAndBlock 2 Call the receivedMediaKeyEvent event and block the event.
kModeEventAndPass 3 Call the receivedMediaKeyEvent event and pass the event to other applications.
kModePass 0 Pass event to other applications.

This class has no sub classes.

Some examples which use this class:

Blog Entries

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

MDQueryMBS   -   MemoryBlock

The biggest plugin in space...

MBS FileMaker blog