Suppressing unwanted pointer events
S60 5th Edition
|ID||Creation date||November 9, 2008|
|Platform||S60 5th Edition||Tested on devices|
|Keywords (APIs, classes, methods, functions): Touch UI Utilities API, CAknPointerEventSuppressor, SuppressPointerEvent()|
Enabling support of touch UI brought, apart of the new possibilities, additional problems to be solved. One of them is suppressing unwanted pointer events. And the typical case of such events filtering is enabling 'finger-friendly' mode in an application. Using fingers instead of stylus supposes less accurate tapping, dragging. For example activating of rather small area on the screen with fingers could lead to unwanted drag events as area of finger touch could vary at run-time.
To help in solving such situations S60 5th Edition SDK provides CAknPointerEventSuppressor class, which is a part of Touch UI Utilities API. The core method of this class is SuppressPointerEvent(const TPointerEvent &aPointerEvent) - for testing whether the specified pointer event should be ignored. And to set options of suppressing pointer events three methods are implemented: SetMaxTapDuration(TTimeIntervalMicroSeconds aDuration), SetMaxTapMove (TSize aMoveLimits), SetMinInterDragInterval(TTimeIntervalMicroSeconds aInterval).
CAPABILITY could be self-signed
class CSampleControl: ...
TBool iTap; // Boolean flag to indicate whether tap event occured
iSuppressor = CAknPointerEventSuppressor::NewL();
// Tuning up rather small control to enable 'finger-friendly' mode
// Set max tap duration interval to 0.3 sec
// Set max tap move as half of control size
TSize controlSize = Size();
// Set minimum interval between drag events to 0.2 sec
void CSampleControl::HandlePointerEventL(const TPointerEvent& aPointerEvent)
// Check whether pointer event meets established earlier criteries
// Distinguish tap events from drag events
iTap = ETrue; // Set flag to ETrue
iTap = EFalse; // Reset flag to EFalse,
// just because the following EButton1Up event should
// should not be handled as tap event
Unwanted pointer events have been suppressed.