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.
Detecting long tap using CAknLongTapDetector
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.
The following capabilities and libraries are required:
Your UI control should implement the MAknLongTapDetectorCallBack interface.
class CImageConverterContainer : public CCoeControl,
public MCoeControlObserver, public MAknLongTapDetectorCallBack
private: // From MAknLongTapDetectorCallBack
void HandleLongTapEventL( const TPoint& aPenEventLocation,
const TPoint& aPenEventScreenLocation );
// 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.