Probably the best looking (and animated) switch control: The ZAZ: ZirconSwitch
Hmm…when I copy that from the example project it crashes at the ArtisanKit Control Paint event with NilObjectException:
Highlighted = IsKeyWindow(Self.TrueWindow.Handle) Or IsMainWindow(Self.TrueWindow.Handle)
Make sure you have the latest version of Artisan Kit. I had some issues with some Zircon controls because I had an older version of AK.
Version 1.2.2 is the latest…but still crashes at the paint event.
Had to replace:
Highlighted = IsKeyWindow(Self.TrueWindow.Handle) Or IsMainWindow(Self.TrueWindow.Handle)
with:
Highlighted = IsKeyWindow(Self.Window.Handle) Or IsMainWindow(Self.Window.Handle)
Works now (o;
Hmmm…thought this ZirconSwitch works with touchscreen on Raspberry Pi…
Well…it does only when at the same time the mouse pointer is over the switch control, otherwise the switch ignores touch presses…
Okay…found this behavior on RPi with touchscreen:
Placed three ZirconSwitch controls vertically.
And when I touch one of them, only the switch is toggled where the mouse points to.
So the touch is recognized, but the event doesn’t get its XY location but takes the one from a mouse.
This happens also with a regular DesktopButton or DesktopCheckbox, when I touch it, the control where the mouse points to gets the update.
When no mouse is connected, then the regular controls like DesktopButton, DesktopCheckbox are working normally.
You should contact Thom McGrath about this.
I remember a post from a few days ago saying that Xojo does not offer real touch events. I guess that if your touchscreen does not behaves like mouse (move the pointer and simulate the click) then it doesn’t work.
Maybe you can create an issue, explain the problem with the RPi and the touchscreen you are using. I think it will be in Xojo’s interest to sort this out because people my try the Free linux/RPi license and if that is not good, they will not buy license for other targets. Having a good first impression for potential clients is a must.
Already wrote to Alyssa about this…and for the PopOver (for displaying a keyboard) I filed already an issue for Linux.
For HMI a Raspberry Pi with touchscreen is well suited. And having Xojo supporting touch or even gesture, that would be a killer
I just tested this out on a Pi5 project with touch screen and it worked great. I did not need to make any changes to the test project. Controls worked great as well as speakers that are part of the Pi5 touch screen.
Now I am looking forward to the next project to include these controls.
Nice that it works for you…but it doesn’t work for all touchscreen with custom controls like the Zircon switch. Only when the mouse pointer is above the control.
Just tested with a Waveshare 11.6" HDMI touchscreen.
See also: https://tracker.xojo.com/xojoinc/xojo/-/issues/77347
And as I have to finish a touchscreen project be end of November I have definitively go the PyQt6 or Kivy route…