Is it possible to catch three finger back/forward-events in a Canvas or a Window using declares? I know it can be done easily with MBS, but I’m looking for a plugin-less alternative.
Have you had a look here ?
https://forum.xojo.com/12169-detect-gesture-and-fingers-on-a-trackpad
Yes, and it’s not quite what I’m looking for. I want to catch the native swipe event of OS X.
Actually, now that I took a closer look at the TouchDemo.xojo_binary_project, there seems to be some declares with swipeWithEvent.
Well, you need to subclass the view, add methods for catching the messages and forward them to superclass. Than you can process them.
I started to implement swipe but didn’t need it at the time so a bit of the code is already there and it’ll probably just mirror the other gestures. Last night I began to finish that for the other thread but noticed swipe has some extra options, got sidetracked researching that and eventually went celebrating. Got as far as the swipe event type is 31 Anyways, if it follows the other gestures I should have time to add it later today. Not sure what to make of the extra options until I understand them. Of course anybody is free to udpate/refactor TouchDemo.
I managed to slim down TouchDemo to a subclass of a Canvas with swipe detection. Unfortunately it’s crashing on RaiseEvent and I don’t have the slightest idea how to fix it.
Did you have the time to add swipe to your demo? I guess adding those declares directly in Canvas Open-event makes the Canvas unstable and it crashes.
This is very odd. I just did this, stripped down to a single class with only swipe, got it working but was confused by what’s considered a swipe. Added begin/endGesture and sometimes what was working wouldn’t and vice-versa. Using Safari to check when swiping should happen it got munged, pages would shift a bit and get stuck. Time for a reboot, which hasn’t happened in awhile so I took the opportunity to upgrade to 10.9.3, now 3 finger swiping is consistent but I swear it was triggering begin/endGesture before, not anymore.
A curious event, I usually have 3 finger dragging ON so would never see it. 2 finger swiping goes somewhere’s else, I think scrollWheel? Maybe these need to be used to finish off…
NSResponder
wantsForwardedScrollEventsForAxis:
wantsScrollEventsForSwipeTrackingOnAxis:
NSEvent
isSwipeTrackingFromScrollEventsEnabled
trackSwipeEventWithOptions:dampenAmountThresholdMin:max:usingHandler:
And I found the answer here enlightening http://stackoverflow.com/questions/12748072/how-to-properly-use-swipewithevent-to-navigate-a-webview-obj-c
Well, this is all news to me. I didn’t know that three finger swipe isn’t the default preference anymore. But your CanvasSwipe is perfect for what I need now, so thank you very much!