You might try GraffitiSwitch, which is not only resizable but it is pure Xojo code so you can implement the touch events yourself if they don’t work out of the box.
you could subclass a canvas and see behavior context menu to enable own properties in the inspector if the control is used in a window.
mouse down event should be same as touch click.
in sub classed canvas you can define any event and raise this from mouse event. OnOffSwitchTest.zip (2.2 MB)
Regular buttons work with touchscreen with the “pressed” event…
Tried a similar thing where I wanted an settings icon to popup a settings window…
even with the DesktopBevelButton class with the pressed event doesn’t trigger with touchscreen.
I assume Xojo put the the past years effort more into mobile apps…
Though I believe that Arm64 embedded systems with touchscreens would benefit much for HMI applications with Xojo…as Kivy isn’t that fancy anymore. This leaves only one choice then: PyQt6.
In attempt to research the problem then I updated Linux Bridge Plugin a bit so I could test.
This is how I launch the app:
My understanding is that you can set touch screen emulator like that to test
On Canvas Opening event I got
Sub Opening() Handles Opening
using EinhugurLinuxBridgeGtk
can = me
var widget as GtkWidget = GtkWidget.FromIntegerPtr(Integer(me.Handle))
widget.EventMask = (widget.EventMask or 4194304) // Adding GDK_TOUCH_MASK
widget.SignalConnect(GtkWidget.signal_touch_event, addressof OnTouch, nil)
End Sub
And on the callback I got:
Private Shared Sub OnTouch(widget as Ptr, evnt as Ptr, user_data as Ptr)
using EinhugurLinuxBridgeGtk
var theEvent as GdkEvent = GdkEvent.FromIntegerPtr(Integer(evnt))
select case theEvent.Type
case GdkEventType.TOUCH_BEGIN
Window1(can.Window).ListBox1.AddRow("Touch begin")
case GdkEventType.TOUCH_UPDATE
Window1(can.Window).ListBox1.AddRow("Touch update")
case GdkEventType.TOUCH_END
Window1(can.Window).ListBox1.AddRow("Touch end")
case GdkEventType.TOUCH_CANCEL
Window1(can.Window).ListBox1.AddRow("Touch cancel")
case else
MessageBox "Something else !!"
end select
End Sub
Problem is I am not getting anything…and I dont know if its because I am doing something wrong or need to do something more or if this is incorrect way to do touch emulation ?
I have many Xojo Windows apps which seem to treat treat touch events as MouseDown or Action. Buttons, Canvases, ContainerControls all work fine on Dell touch-screen PCs.
I ran across similar touch screen issues as I am working on a Rasp Pi5 project using a 7" Touch Screen. Check this thread " Pi Official 7” Touch Screen - some problems" for work around solutions.
I needed to add a driver and then after experimenting I made extensive use of DesktopLabel (Mouse Down returns true then Mouse UP to do whatever) and SubClass DesktopCanvas used for color changes.
Thanks to Pawel Soltysinski for sharing his experience and keyboard solution which I have modified several times for differnent keyboard needs. His solution actually presents some good ideas on how to implement touch screen on Rasp Pi and for that matter should work with comparable Linux platforms.