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.

Revision as of 06:54, 20 June 2012 by pooja_1650 (Talk | contribs)

Detecting long tap using CAknLongTapDetector

From Wiki
Jump to: navigation, search
Article Metadata
Tested with
Devices(s): Nokia 5800 XpressMusic
Platform(s): S60 5th Edition
Keywords: CAknLongTapDetector, MAknLongTapDetectorCallBack
Created: tepaa (14 Oct 2008)
Last edited: pooja_1650 (20 Jun 2012)



CAknLongTapDetector receives pointer events from the owner application or owner control and returns the location if a long tap event occurs.

After a short period of time (the default is 0.15 seconds), an animation is displayed on the screen next to the stylus to inform the user of the long tap functionality. The animation can be turned OFF by the application if desired.

This snippet can be self-signed.

MMP file

The following capabilities and libraries are required:

CAPABILITY 	None       
LIBRARY avkon.lib

Header file

Your UI control should implement the MAknLongTapDetectorCallBack interface.

#include <aknlongtapdetector.h> 
class CImageConverterContainer : public CCoeControl,
public MCoeControlObserver, public MAknLongTapDetectorCallBack
private: // From MAknLongTapDetectorCallBack
void HandleLongTapEventL( const TPoint& aPenEventLocation,
const TPoint& aPenEventScreenLocation );
CAknLongTapDetector* iLongTapDetector;

Source file

// Create long tap detector
void CImageConverterContainer::ConstructL(const TRect& /*aRect*/)
iLongTapDetector = CAknLongTapDetector::NewL(this);
// Redirect pointer events to long tap detector
void CImageConverterContainer::HandlePointerEventL(const TPointerEvent&
// This method is called when long tap occurs
void CImageConverterContainer::HandleLongTapEventL( const TPoint&
aPenEventLocation, const TPoint& aPenEventScreenLocation )
// TODO: What to do when long tap detected


Long taps can be detected in the application.

See also

S60 Platform: Image Converter Example

60 page views in the last 30 days.