Symbian3/SDK/Source/GUID-4D2AA522-82AB-4D1E-9F1E-5C6A35DEF195.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Thu, 11 Mar 2010 15:24:26 +0000
changeset 2 ebc84c812384
parent 0 89d6a7a84779
permissions -rw-r--r--
week 10 bug fix submission: Bug 1892, Bug 1897, Bug 1319. Also 3 or 4 documents were found to contain code blocks with SFL, which has been fixed. Partial fix for broken links, links to Forum Nokia, and the 'Symbian platform' terminology issues.

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-4D2AA522-82AB-4D1E-9F1E-5C6A35DEF195" xml:lang="en"><title>Pointer
events</title><prolog><metadata><keywords/></metadata></prolog><conbody>
<p><draft-comment time="2007-02-26T14:58">Add some additional contextual
information and examples in a future release of the library.</draft-comment></p>
<p>Pointer events are handled by the controls. A control should implement
the function <xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/reference/reference-cpp/Control_Environment/CCoeControlClass.html#%3a%3aCCoeControl%3a%3aHandlePointerEventL%28const%20TPointerEvent%20%26amp%3b%29" format="application/java-archive"><parmname>CCoeControl:HandlePointerEventL()</parmname></xref>  to be
able to handle pointer events. The <xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/reference/reference-cpp/Control_Environment/CCoeControlClass.html#%3a%3aCCoeControl%3a%3aHandlePointerEventL%28const%20TPointerEvent%20%26amp%3b%29" format="application/java-archive"><parmname>CCoeControl:HandlePointerEventL()</parmname></xref> function
is called by the framework whenever a pointer event occurs within the control. </p>
<codeblock id="GUID-F12E88CC-31FF-4C26-8FEC-0BC2C7717907" xml:space="preserve">virtual void HandlePointerEventL(const TPointerEvent&amp; aPointerEvent)
</codeblock>
<p>Before passing pointer events to controls, the framework does some processing
for the event. If a <xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/reference/reference-cpp/Window_Server/TPointerEventStruct.html#%3a%3aTPointerEvent%3a%3aEButton1Down" format="application/java-archive"><parmname>TPointerEvent::EButton1Down</parmname></xref> event occurred in the control and the control does not currently
have keyboard focus, it sends an event of type <xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/reference/reference-cpp/Control_Environment/MCoeControlObserverClass.html#%3a%3aMCoeControlObserver%3a%3aEEventRequestFocus" format="application/java-archive"><parmname>MCoeControlObserver::EEventRequestFocus</parmname></xref> to the control's
observer — normally the control's container. The container control should
then set focus onto the control in which the <xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/reference/reference-cpp/Window_Server/TPointerEventStruct.html#%3a%3aTPointerEvent%3a%3aEButton1Down" format="application/java-archive"><parmname>TPointerEvent::EButton1Down</parmname></xref> event occurred. </p>
<p>Note that, by default, pointer drag events and pointer move events are
not delivered to controls. For additional information, see functions <xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/reference/reference-cpp/Window_Server/RWindowBaseClass.html#%3a%3aRWindowBase%3a%3aPointerFilter%28TUint32%2cTUint32%29" format="application/java-archive"><parmname>RWindowBase::PointerFilter()</parmname></xref> and <xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/reference/reference-cpp/Control_Environment/CCoeControlClass.html#%3a%3aCCoeControl%3a%3aClaimPointerGrab%28TBool%29" format="application/java-archive"><parmname>CCoeControl::ClaimPointerGrab()</parmname></xref>. The following
code example demonstrates usage of the <parmname>TPointerEvent </parmname>class:</p>
<codeblock id="GUID-E050A4D7-995E-4819-B172-DCA432E3191F" xml:space="preserve">void CEventsAppView::HandlePointerEventL( const TPointerEvent&amp; aPointerEvent )
    {
    switch( aPointerEvent.iType )
        {
        case TPointerEvent::EButton1Down:
            {
            // Button 1 down
            // Get pointer position
            TPoint positionX = aPointerEvent.iPosition.iX;
            TPoint positionY = aPointerEvent.iPosition.iY;
            break;
            }
        case TPointerEvent::EButton1Up:
            {
            // button 1 up
            break;
            }
        case TPointerEvent::EDrag:
            {
            // drag event
            break;
            }
        case TPointerEvent::EMove:
            {
            // move event
            break;
            }
        default:
            {
            // do something
            break;
            }
        }
    }   </codeblock>
</conbody></concept>