I'm writing something for a touchscreen phone. I'd like the program to run a specified function when the user taps on the screen. I'd like to scroll the screen when the user drags a finger up or down the screen.
The OS has three relevant callback functions (1) detect when screen is touched, (2) detect when finger is dragged on screen and (3) detect when the finger leaves the screen. In each case, the callback function gets the screen coordinates where the relevant event happened.
The problem is that a drag obviously starts with a finger touching the screen and ends when the finger leaves the screen. Tapping is usually detected as a touch, very short drag and end touch. If I just call my specified function on a tap, I'll trigger on screen drag events rather than genuine taps.
The best I can think of is to mark the time or location when the user first touches. If we are in the drag callback function a short time or distance later, treat it as a scroll. Otherwise, if there's been a leave-the-screen callback, treat it as a tap. Issues include the cost of noting the time, deciding how much time or distance to use as a trigger and if there is a better general approach.
My app is in python for a symbian device. As that's not a very popular platform, any suggestions for the best way to implement would be appreciated.