Symbian3/SDK/Source/GUID-33D93E96-98A9-4116-9028-3241D76A1036.dita
changeset 8 ae94777fff8f
parent 7 51a74ef9ed63
equal deleted inserted replaced
7:51a74ef9ed63 8:ae94777fff8f
     7     Nokia Corporation - initial contribution.
     7     Nokia Corporation - initial contribution.
     8 Contributors: 
     8 Contributors: 
     9 -->
     9 -->
    10 <!DOCTYPE concept
    10 <!DOCTYPE concept
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
    12 <concept id="GUID-33D93E96-98A9-4116-9028-3241D76A1036" xml:lang="en"><title>Enabling
    12 <concept id="GUID-33D93E96-98A9-4116-9028-3241D76A1036" xml:lang="en"><title>Enabling additional touch events for your application</title><shortdesc>The Symbian platform provides additional touch events to
    13 additional touch events for your application</title><shortdesc>The Symbian platform provides additional touch events to enable
    13 enable drag events and to specify screen areas for touch events.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
    14 drag events using <parmname>CCoeControl::EnableDragEvents()</parmname>and
    14 <p>By default, the Symbian platform sends only <parmname>EButton1Up</parmname> and <parmname>EButton1Down</parmname> touch events to applications.</p>
    15 to specify screen areas for touch events.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
    15 <p>If you want to enable <parmname>EDrag</parmname> touch events,
    16 <p>By default, the Symbian platform sends only <parmname>EButton1Up</parmname> and <parmname>EButton1Down</parmname> touch
    16 implement <xref href="GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160.dita#GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160/GUID-66B1D0C0-BFBB-36DB-BCC2-5563895251D5"><apiname>CCoeControl::EnableDragEvents()</apiname></xref> in your
    17 events to applications.</p>
    17 container class.</p>
    18 <p>If you want to enable <parmname>EDrag</parmname> touch events, implement <parmname>CCoeControl::EnableDragEvents()</parmname> in
    18 <p>When the mobile device user drags the stylus on the screen, <xref href="GUID-1FFA0073-3D83-388E-A824-08C31F90CC54.dita#GUID-1FFA0073-3D83-388E-A824-08C31F90CC54/GUID-5375D595-CF6A-38F6-9D62-E8DDF2D2BCF6"><apiname>TPointerEvent::EDrag()</apiname></xref> events are sent. When dragging stops,
    19 your container class.</p>
    19 the application receives the event <xref href="GUID-1FFA0073-3D83-388E-A824-08C31F90CC54.dita#GUID-1FFA0073-3D83-388E-A824-08C31F90CC54/GUID-5BADE607-E845-34B2-9C2D-B6882B7D4288"><apiname>TPointerEvent::EButton1Up()</apiname></xref>.</p>
    20 <p>When the mobile device user drags the stylus on the screen, <codeph>TPointerEvent::EDrag()</codeph> events
       
    21 are sent. When dragging stops, the application receives the event <codeph>TPointerEvent::EButton1Up()</codeph>.</p>
       
    22 <codeblock xml:space="preserve">void CTableauControl::ConstructL( const TRect&amp; aRect )
    20 <codeblock xml:space="preserve">void CTableauControl::ConstructL( const TRect&amp; aRect )
    23     {
    21     {
    24     // This is parent window
    22     // This is parent window
    25     CreateWindowL();
    23     CreateWindowL();
    26 
    24 
    27     EnableDragEvents();
    25     EnableDragEvents();
    28 
    26 
    29     //SetRect( aRect );
    27     SetRect( aRect );
    30     SetExtentToWholeScreen();
    28     SetExtentToWholeScreen();
    31     
    29     
    32     
    30     
    33     // Initialize component array
    31     // Initialize component array
    34     InitComponentArrayL();
    32     InitComponentArrayL();
    35     
    33     
    36     
    34     
    37 	 //Implement your own logic here
    35 	 //Implement your own logic here
    38   	 ActivateL();
    36   	 ActivateL();
    39     }</codeblock>
    37     }</codeblock>
    40 <p>It is enough that the container control set <codeph>EnableDragEvents()</codeph> in
    38 <p>It is enough that the container control set <codeph>EnableDragEvents()</codeph> in its construction. <codeph>EnableDragEvents()</codeph> need not
    41 its construction. <codeph>EnableDragEvents()</codeph> need not be set again
    39 be set again for the child controls to receive dragging events.</p>
    42 for the child controls to receive dragging events.</p>
       
    43 <section id="GUID-7B30F0D5-1EAE-4F40-B04F-6A3953BCC634"><title>Controlling
    40 <section id="GUID-7B30F0D5-1EAE-4F40-B04F-6A3953BCC634"><title>Controlling
    44 which control receives a touch event</title><p>Particularly when you are receiving
    41 which control receives a touch event</title><p>Particularly when you
    45 drag events it may be that an object in the window may be drawn by one control,
    42 are receiving drag events it may be that an object in the window may
    46 while the pointer is over another control. In cases where you want to ensure
    43 be drawn by one control, while the pointer is over another control.
    47 that pointer events are received by the intended control, implement <parmname>CCoeControl::SetPointerCapture()</parmname>.</p><p>When
    44 In cases where you want to ensure that pointer events are received
    48 a control receives a <parmname>TPointerEvent::EButton1Down()</parmname> event,
    45 by the intended control, implement <xref href="GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160.dita#GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160/GUID-172FDC09-7870-3FD0-9252-340178C58C28"><apiname>CCoeControl::SetPointerCapture()</apiname></xref>.</p><p>When a control receives a <xref href="GUID-1FFA0073-3D83-388E-A824-08C31F90CC54.dita#GUID-1FFA0073-3D83-388E-A824-08C31F90CC54/GUID-26CE2524-04BC-3592-A7E5-7EEC792A466E"><apiname>TPointerEvent::EButton1Down()</apiname></xref> event, all events will be sent to this control until the next <xref href="GUID-1FFA0073-3D83-388E-A824-08C31F90CC54.dita#GUID-1FFA0073-3D83-388E-A824-08C31F90CC54/GUID-5BADE607-E845-34B2-9C2D-B6882B7D4288"><apiname>TPointerEvent::EButton1Up()</apiname></xref> event. If you want to have
    49 all events will be sent to this control until the next <parmname>TPointerEvent::EButton1Up()</parmname> event.
    46 events to be sent to another control before the<xref href="GUID-1FFA0073-3D83-388E-A824-08C31F90CC54.dita#GUID-1FFA0073-3D83-388E-A824-08C31F90CC54/GUID-5BADE607-E845-34B2-9C2D-B6882B7D4288"><apiname>TPointerEvent::EButton1Up()</apiname></xref> event, call <codeph>SetPointerCapture(ETrue)</codeph> from the new
    50 If you want to have events to be sent to another control before the <parmname>TPointerEvent::EButton1Up()</parmname> event,
    47 control. </p><p>When the new control has received its pointer event
    51 call <codeph>SetPointerCapture(ETrue)</codeph> from the new control. </p><p>When
    48 and <xref href="GUID-1FFA0073-3D83-388E-A824-08C31F90CC54.dita#GUID-1FFA0073-3D83-388E-A824-08C31F90CC54/GUID-5BADE607-E845-34B2-9C2D-B6882B7D4288"><apiname>TPointerEvent::EButton1Up()</apiname></xref> has been received,
    52 the new control has received its pointer event and <parmname>TPointerEvent::EButton1Up()</parmname> has
    49 you have to call <codeph>SetPointerCapture(EFalse)</codeph> from the
    53 been received, you have to call <codeph>SetPointerCapture(EFalse)</codeph> from
    50 new control to stop events being sent to it indefinitely.</p></section>
    54 the new control to stop events being sent to it indefinitely.</p></section>
       
    55 <section id="GUID-8C337F8B-346A-430A-9A7A-A48B53031421"><title>Specifying
    51 <section id="GUID-8C337F8B-346A-430A-9A7A-A48B53031421"><title>Specifying
    56 screen areas for touch events</title><p>To specify screen areas (<codeph>TRect</codeph>)
    52 screen areas for touch events</title><p>To specify screen areas (<codeph>TRect</codeph>) for touch events, see the example below.</p><codeblock xml:space="preserve">void CTableauControl::HandlePointerEventL(const TPointerEvent&amp; aPointerEvent)
    57 for touch events, see the example below.</p><codeblock xml:space="preserve">void CTableauControl::HandlePointerEventL(const TPointerEvent&amp; aPointerEvent)
       
    58     {
    53     {
    59     // Does the user point exit text on screen? 
    54     // Does the user point exit text on screen? 
    60     // iExitRect is rectangle of the text area on screen.
    55     // iExitRect is rectangle of the text area on screen.
    61     if (iExitRect.Contains(aPointerEvent.iPosition))
    56     if (iExitRect.Contains(aPointerEvent.iPosition))
    62         {
    57         {
    67             return;
    62             return;
    68             }
    63             }
    69         }
    64         }
    70     ...
    65     ...
    71     }</codeblock></section>
    66     }</codeblock></section>
    72 <section id="GUID-8B12AF1C-A98A-416D-A586-807CFC2B839D"><title>Ignoring events
    67 <section id="GUID-8B12AF1C-A98A-416D-A586-807CFC2B839D"><title>Ignoring
    73 other than pointer up in your control</title><p>In cases where you want to
    68 events other than pointer up in your control</title><p>In cases where
    74 make sure your control receives only touch <parmname>EButton1Up</parmname> events
    69 you want to make sure your control receives only touch <parmname>EButton1Up</parmname> events after receiving a touch <parmname>EButton1Down</parmname> event, implement <xref href="GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160.dita#GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160/GUID-885AF2EB-587A-323B-99B5-019B2E7EBC78"><apiname>CCoeControl::IgnoreEventsUntilNextPointerUp()</apiname></xref>. </p></section>
    75 after receiving a touch <parmname>EButton1Down</parmname> event, implement <parmname>CCoeControl::IgnoreEventsUntilNextPointerUp()</parmname>. </p></section>
       
    76 </conbody></concept>
    70 </conbody></concept>