This page was last modified on 30 September 2009, at 06:05.
ID | ... | Creation date | 26.10.2008 |
Platform | S60 5th Edition | Tested on devices | Nokia 5800 XpressMusic. |
Category | Symbian C++ | Subcategory | Touch UI |
Keywords (APIs, classes, methods, functions): HandlePointerEventL(),Custom Control. |
Overview
This snippet shows how to handle Pointer events in a custom control and route them to a proper component control by validating the pointer area against the control rect.
This snippet can be self-signed.
Preconditions
Here we assume that we already have a working code for custom control, and we also assume that we have two components: iEdwin1 and iEdwin2 in a custom control.
MMP file
The following capabilities and libraries are required:
CAPABILITY None
LIBRARY cone.lib
#include <COECNTRL.H>
void CCustomContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent)
{
// Validate pointer position.
if( iEdwin1->Rect().Contains( aPointerEvent.iPosition ) )
{
// click on edwin1 pass the pointer event. //
iEdwin1->HandlePointerEventL( aPointerEvent );
}
else if( iEdwin2->Rect().Contains( aPointerEvent.iPosition ) )
{
// click on edwin2 pass the pointer event. //
iEdwin2->HandlePointerEventL( aPointerEvent );
}
else
{
// simply calling the base class implementation //
CCoeControl::HandlePointerEventL(aPointerEvent);
}
}
Postconditions
Pointer position will validated against the control rectangle and the pointer events will be routed to appropriate control.