s60 5.0接收UI触击事件

来源:互联网 发布:中国金融数据 编辑:程序博客网 时间:2024/05/29 14:32

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 detectoriLongTapDetector = CAknLongTapDetector::NewL(this); // Your component pointer event handlingvoid 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    }
原创粉丝点击