2021-07-02 06:10 AM
So assume there is a container that should react differently in either of the following conditions:
Is this doable? Could someone maybe post the pseudocode?
I know how to handle single click, by checking in the 'Click Listener' of the container. Then in the screen handleTickEvent() I can differentiate whether the container still pressed or not to differentiate between short press and long press. But now, how to detect swipe event?
2021-07-05 12:38 AM
Hi,
You could use the handleDragEvent() function which will detect the swipe. I think there are a couple of posts on this forum on how to work with it, or custom code to get the deltaX (to handle the swipe).
/Romain
2021-07-05 06:52 PM
Thank you @Romain DIELEMAN , but we have to define a swipe container to have handleDragEvent() handler available to us? This would not be available in normal container?
2021-07-22 03:37 AM
This function is available in all containers. You just have to override it with your own definition…
To distinguish between short and long press, you've got to override the 'handleClickEvent' and 'handleTickEvent' function… When you catch a 'ClickEvent::PRESSED' in your handleClickEvent, simply call the function registerTimerWidget and start counting the time in the handleTickEvent function… If your counter goes past 1sec, you know it's a long press… And don't forget to call unregisterTimerWidget once you're done measuringr the time (for instance when you receive a ClickEvent::RELEASED or ClickEvent::CANCEL.
2021-07-25 04:21 PM
Thank you @GMeur , I did override the handleDragEvent() , but when I dragged my box, it never hit the breakpoint set inside the handler function.