Symbian3/SDK/Source/GUID-422F37DF-F93F-443F-86EA-6A696A53E1E6.dita
changeset 7 51a74ef9ed63
child 8 ae94777fff8f
equal deleted inserted replaced
6:43e37759235e 7:51a74ef9ed63
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept id="GUID-422F37DF-F93F-443F-86EA-6A696A53E1E6" xml:lang="en"><title>Listening
       
    13 for scrollbar touch events</title><shortdesc>If your custom control contains a scrollbar, you need to listen
       
    14 for touch events in the scrollbar.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    15 <p>For custom controls that override <codeph>CCoeControl::HandleScrollEventL()</codeph>,
       
    16 you must also call the base class implementation of the function.</p>
       
    17 <fig id="GUID-ECD9B9C0-0134-4D8A-B350-A797A5C1BE0F">
       
    18 <title>Scrollbar</title>
       
    19 <image href="GUID-8C8D6B06-E794-4269-B4DF-D2BE4DDB9E8B_d0e43877_href.png" scale="40" placement="inline"/>
       
    20 </fig>
       
    21 <p>For an implementation example, see below.</p>
       
    22 <codeblock xml:space="preserve">void CMyContainerControl::HandleScrollEventL( CEikScrollBar* aScrollBar, TEikScrollEvent aEventType )
       
    23     {
       
    24     if( !aScrollBar )
       
    25         {
       
    26         return;
       
    27         }
       
    28 
       
    29     TInt newPosition = aScrollBar-&gt;ThumbPosition();
       
    30     
       
    31     switch( aEventType )
       
    32         {
       
    33         case EEikScrollUp: // Moving up one step
       
    34             {
       
    35             MoveFocusUpL();
       
    36             break;
       
    37             }
       
    38         case EEikScrollDown: // Moving down one step
       
    39             {
       
    40             MoveFocusDownL();
       
    41             break;
       
    42             }
       
    43         case EEikScrollThumbDragVert: // Drag started
       
    44         case EEikScrollThumbReleaseVert: // Drag released
       
    45             {
       
    46             if( newPosition &lt; iFocusedIndex )
       
    47                 {
       
    48                 MoveFocusUpL();
       
    49                 }
       
    50             else if( newPosition &gt; iFocusedIndex )
       
    51                 {
       
    52                 MoveFocusDownL();
       
    53                 }
       
    54             break;
       
    55             }
       
    56         case EEikScrollPageUp:
       
    57             {
       
    58             while( newPosition &lt; iFocusedIndex )
       
    59                 {
       
    60                 MoveFocusUpL();
       
    61                 }
       
    62             break;
       
    63             }
       
    64         case EEikScrollPageDown:
       
    65             {
       
    66             while( newPosition &gt; iFocusedIndex )
       
    67                 {
       
    68                 MoveFocusDownL();
       
    69                 }
       
    70             break;
       
    71             }
       
    72         default:
       
    73             {
       
    74             break;
       
    75             }
       
    76         }
       
    77     DrawNow();
       
    78     }</codeblock>
       
    79 </conbody></concept>