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.

Handling pointer events in Symbian C++

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

The article is believed to be still valid for the original topic scope.

Article Metadata
Code ExampleTested with
Devices(s): Nokia 5800 XpressMusic
Platform(s): S60 5th Edition
Keywords: CCoeControl::HandlePointerEventL()
Created: tepaa (03 Oct 2008)
Last edited: lpvalente (23 Sep 2014)



S60 5th Edition supports touch events. All AVKON UI controls handle touch UI events and you do not need to implement anything new.

However, in your custom CCoeControl UI control you must implement event handling yourself. This can be done by implementing the virtual base class method CCoeControl::HandlePointerEventL().

The most common touch events are:

* EButton1Down (=pen down)
* EButton1Up (=pen up)
* EDrag (dragging with pen)

The other events can be found from struct TPointerEvent in the w32sth.h header.

MMP file

The following libraries are required:

LIBRARY cone.lib

Header file

void HandlePointerEventL(const TPointerEvent& aPointerEvent);

Source file

It is good practice to call the base class method from your custom control HandlePointerEventL() method. If your custom control is a container control that has child CCoeControls, then they will receive pointer events too, which is what the base class implementation does.

void CMyContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent)
// Remember to call base class implementation. Then your child controls
// receive pointer events.
// Rest of your code
if (aPointerEvent.iType == TPointerEvent::EButton1Down)
// TODO: What to do when this ui control receives pen down event...


Touch event received.

Supplementary material

  • You can test pointer events handling in a simple, executable application into which this code snippet has been patched. The application is available for download at: Media:ExampleStub w pointer
  • You can examine all the changes that are required to implement pointer events handling in an application. The changes are provided in unified diff and color-coded diff formats: Media:CS001144 Handling pointer
  • For general information on applying the patch, see Using Diffs.
  • For unpatched stub applications, see Example stub.

See also

This page was last modified on 23 September 2014, at 19:57.
56 page views in the last 30 days.