Namespaces

Variants
Actions

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 over the next few weeks. 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
Compatibility
Platform(s): S60 5th Edition
Article
Keywords: CAknLongTapDetector, MAknLongTapDetectorCallBack
Created: tepaa (14 Oct 2008)
Last edited: pooja_1650 (20 Jun 2012)

Contents

Overview

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 );
 
private:
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&
aPointerEvent)
{
iLongTapDetector->PointerEventL(aPointerEvent);
...
}
 
// 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
...
}


Postconditions

Long taps can be detected in the application.

See also

S60 Platform: Image Converter Example

225 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×