Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Suppressing unwanted pointer events

From Wiki
Jump to: navigation, search
Article Metadata
S60 5th Edition
Created: Damavik (09 Nov 2008)
Last edited: hamishwillee (01 Aug 2012)
ID   Creation date  November 9, 2008
Platform  S60 5th Edition Tested on devices  
Category  Symbian C++ Subcategory  

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).

MMP file

LIBRARY avkon.lib
CAPABILITY could be self-signed

Header file

#include <aknpointereventsuppressor.h>
class CSampleControl: ...
void ConstructL();
CAknPointerEventSuppressor* iSuppressor;
TBool iTap; // Boolean flag to indicate whether tap event occured

Source file

void CSampleControl::ConstructL()
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();
iSuppressor->SetMaxTapMove(TSize(controlSize.iWidth/2, controlSize.iHeight/2));
// Set minimum interval between drag events to 0.2 sec
void CSampleControl::HandlePointerEventL(const TPointerEvent& aPointerEvent)
// Check whether pointer event meets established earlier criteries
if (iSuppressor->SuppressPointerEvent(aPointerEvent))
// Distinguish tap events from drag events
switch (aPointerEvent.iType)
case TPointerEvent::EButton1Down:
iTap = ETrue; // Set flag to ETrue
case TPointerEvent::EButton1Up:
if (iTap)
case TPointerEvent::EDrag:
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.

See also

Handling pointer events in Symbian C++

Enabling drag events in Symbian C++ on touch-enabled devices

Pointer capturing in Symbian C++ on touch-enabled devices

This page was last modified on 1 August 2012, at 04:40.
61 page views in the last 30 days.