Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

/MacExtras/Apple Remote/AppleRemote
Required plugins for this example: MBS MacExtras Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacExtras/Apple Remote/AppleRemote
This example is the version from Mon, 18th Jan 2015.
Project "AppleRemote.rbp"
Filetype text
End FileTypes
Class Window1 Inherits Window
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action() if listening then a.stopListening me.Caption="Listen" listening=false else me.Caption="Stop" a.startListening listening=true end if End EventHandler
End Control
Control CheckBox1 Inherits CheckBox
ControlInstance CheckBox1 Inherits CheckBox
EventHandler Sub Action() a.OpenInExclusiveMode = me.Value End EventHandler
End Control
Control ListBox1 Inherits ListBox
ControlInstance ListBox1 Inherits ListBox
End Control
EventHandler Sub Open() a=new MyAppleRemote if not a.RemoteAvailable then MsgBox "No Apple Remote driver found." end if End EventHandler
Property Protected a As AppleRemoteMBS
Property Protected listening As boolean
End Class
MenuBar MenuBar1
MenuItem UntitledMenu1 = ""
MenuItem FileMenu = "&File"
MenuItem FileQuit = "Quit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu0 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
EventHandler Sub Open() if TargetMachO=false then MsgBox "This example needs a MachO target running on Mac OS X." quit end if End EventHandler
End Class
Class MyAppleRemote Inherits AppleRemoteMBS
EventHandler Sub ButtonPressed(ButtonID as integer, PressedDown as boolean, clickCount as Integer) dim s as string dim t as string Select case ButtonID case kRemoteButtonVolumePlus t="Volume plus" case kRemoteButtonVolumeMinus t="Volume minus" case kRemoteButtonMenu t="Menu" case kRemoteButtonPlay t="PLay" case kRemoteButtonRight t="Right" case kRemoteButtonLeft t="Left" case kRemoteButtonRightHold t="Right Hold" case kRemoteButtonLeftHold t="Left Hold" case kRemoteButtonMenuHold t="Menu Hold" case kRemoteButtonPlaySleep t="Play Sleep" case kRemoteControlSwitched t="control switched" else t="?" end Select if ButtonID<>kRemoteControlSwitched then s=str(ButtonID)+" ("+t+")" if PressedDown then s=s+" down " else s=S+" up " end if Window1.ListBox1.AddRow s window1.ListBox1.ListIndex=window1.ListBox1.LastIndex end if End EventHandler
End Class
End Project

See also:

Feedback, Comments & Corrections

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

MBS Xojo Plugins