Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS Phidgets Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Phidgets/Phidgets LCD
This example is the version from Sun, 12th Mar 2022.
Project "Phidgets LCD.xojo_binary_project"
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
MainWindow.list.AddRow "Phidget Library 22 loaded successfully"
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
Dim t As New MyPhidgetLCDMBS
// attach
Call t.openWaitForAttachment(5000)
MainWindow.list.AddRow " Name: " + t.DeviceName
MainWindow.list.AddRow " Serialnumber: " + Str(t.DeviceSerialNumber)
MainWindow.list.AddRow " Device ID: " + Str(t.DeviceID)
MainWindow.list.AddRow " Device Label: " + t.DeviceLabel
MainWindow.list.AddRow " Channel: " + Str(t.Channel)
MainWindow.list.AddRow " ChannelClass: " + Str(t.ChannelClass)+" "+t.ChannelClassName
MainWindow.list.AddRow " ChannelSubclass: " + Str(t.ChannelSubclass)
MainWindow.list.AddRow " Screen size: " + Str(t.screensize)
MainWindow.list.AddRow " Screen width " + Str(t.width)
MainWindow.list.AddRow " Maximum Backlight value: " + Str(t.MaxBacklight)
MainWindow.list.AddRow " Minumum Backlight value: " + Str(t.MinBacklight)
MainWindow.list.AddRow " Maximum Contrast value: " + Str(t.MaxContrast)
MainWindow.list.AddRow " Minumum Contrast value: " + Str(t.MinContrast)
MainWindow.list.AddRow " Device channel count " + Str(t.DeviceChannelCount(0))
Call t.writeText(t.kFont5x8, 0, 0, "Hello World")
// Call t.writeText(t.kFont6x12, 0, 0, "Hello World") // no difference is noted versus 5x8?
t.Backlight = 1.0
t.contrast = 0.5
Call t.Flush
MessageBox "Should see Hello World. Press OK to close interface"
Call t.close
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
Class MyPhidgetLCDMBS Inherits PhidgetLCDMBS
EventHandler Sub Attached()
System.DebugLog CurrentMethodName
// MainWindow.list.AddRow "Device attached"
End EventHandler
EventHandler Sub Detached()
System.DebugLog CurrentMethodName
End EventHandler
EventHandler Sub Error(errorCode as Integer, errorString as String)
System.DebugLog CurrentMethodName
System.DebugLog errorString
End EventHandler
End Class
End Project
See also:
The items on this page are in the following plugins: MBS Phidgets Plugin.