Receiving long tap events
The S60 platform includes CAknLongTapDetector to receive long tap events. CAknLongTapDetector is part of the Touch UI utilities API.
When the stylus is held down in the same position, an animation starts in about 0.15 s to show that the long tap functionality has started. The animation is provided by Avkon and cannot be changed by the application or control. However, animation can be turned off through the CAknLongTapDetector API.
Your class must derive from the MAknLongTapDetectorCallBack interface and implement its virtual HandleLongTapEventL() method.
An example of the header file is presented below.
class CImageConverterContainer : public CCoeControl, MAknLongTapDetectorCallBack
{
...
private: // From MAknLongTapDetectorCallBack
void HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& aPenEventScreenLocation );
private: // Data
CAknLongTapDetector* iLongTapDetector;
...
}
An example of handling long tap events in your code is presented below.
// Create long tap detector
iLongTapDetector = CAknLongTapDetector::NewL(this);
// Your component pointer event handling
void CImageConverterContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent)
{
// You must tell to long tap detector pointer all events that are received
iLongTapDetector->PointerEventL(aPointerEvent);
...
}
void CImageConverterContainer::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& /*aPenEventScreenLocation*/ )
{
// What to do when user did the long tap
}

被折叠的 条评论
为什么被折叠?



