You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Phidgets/Phidget Manager
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Open()
#If TargetWindows
Const path = "Phidget22.dll"
#Else TargetMacOS Then
Const path = "/Library/Frameworks/Phidget22.framework"
#Else
// todo?
#EndIf
If PhidgetManagerMBS.LoadLibrary(path) Then
'MessageBox "OK"
Else
MsgBox PhidgetManagerMBS.LibraryLoadError
Return
End If
End EventHandler
End Class
Class MainWindow Inherits Window
Control list Inherits Listbox
ControlInstance list Inherits Listbox
End Control
EventHandler Sub Open()
System.DebugLog CurrentMethodName
// init it
p = New MyPhidgetManager
p.Open
End EventHandler
Property p As MyPhidgetManager
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
Class MyPhidgetManager Inherits PhidgetManagerMBS
EventHandler Sub Attached(phid as PhidgetMBS)
System.DebugLog CurrentMethodName
MainWindow.list.AddRow "Device attached"
MainWindow.list.AddRow " Name: " + phid.DeviceName
MainWindow.list.AddRow " Serialnumber: " + Str(phid.DeviceSerialNumber)
MainWindow.list.AddRow " Device ID: " + Str(phid.DeviceID)
MainWindow.list.AddRow " Device Label: " + phid.DeviceLabel
MainWindow.list.AddRow " Channel: " + Str(phid.Channel)
MainWindow.list.AddRow " ChannelClass: " + Str(phid.ChannelClass)+" "+phid.ChannelClassName
MainWindow.list.AddRow " ChannelSubclass: " + Str(phid.ChannelSubclass)
MainWindow.list.AddRow ""
End EventHandler
EventHandler Sub Detached(phid as PhidgetMBS)
System.DebugLog CurrentMethodName
MainWindow.list.AddRow "Device detached"
MainWindow.list.AddRow " Name: " + phid.DeviceName
MainWindow.list.AddRow " Serialnumber: " + Str(phid.DeviceSerialNumber)
MainWindow.list.AddRow " Device ID: " + Str(phid.DeviceID)
MainWindow.list.AddRow " Device Label: " + phid.DeviceLabel
MainWindow.list.AddRow " Channel: " + Str(phid.Channel)
MainWindow.list.AddRow " ChannelClass: " + Str(phid.ChannelClass)+" "+phid.ChannelClassName
MainWindow.list.AddRow " ChannelSubclass: " + Str(phid.ChannelSubclass)
MainWindow.list.AddRow ""
End EventHandler
EventHandler Sub Error(errorCode as Integer, errorString as String)
System.DebugLog CurrentMethodName
MainWindow.list.AddRow "Error: "+Str(errorCode)+": "+errorString
End EventHandler
End Class