Symbian3/PDK/Source/GUID-62DF565C-8121-429F-99D0-B5FBDE634AA9.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Thu, 11 Mar 2010 18:02:22 +0000
changeset 3 46218c8b8afa
parent 1 25a17d01db0c
child 5 f345bda72bc4
permissions -rw-r--r--
week 10 bug fix submission (SF PDK version): 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-62DF565C-8121-429F-99D0-B5FBDE634AA9" xml:lang="en"><title>Using
long-tap events</title><prolog><metadata><keywords/></metadata></prolog><conbody>
<p>Long-tap events allow you to specify functions performed when the user
taps and holds the button for a specified period of time. An example of a
long-tap function is fast forwarding in a media player application by tapping
and holding down a button.</p>
<p>To receive long-tap events, use the class <xref href="jar:GUID-759FBC7F-5384-4487-8457-A8D4B76F6AA6.jar!/html/classCAknLongTapDetector.html" format="application/java-archive"><codeph>CAknLongTapDetector</codeph></xref> in the <xref href="jar:GUID-759FBC7F-5384-4487-8457-A8D4B76F6AA6.jar!/html/Touch_UI_Utilities_APIIndexPage.html" format="application/java-archive">Touch
UI utilities API</xref>.</p>
<p>To enable the handling of long tap events in your <codeph>CAknButton</codeph> ,
set the flag <codeph>KAknButtonReportOnLongPress</codeph> for the button.
When the long tap event starts,<codeph> CAknButton::ELongPressEvent</codeph> is
reported to the button observer (<codeph>MCoeControlObserver</codeph>). When
the long tap event ends, <codeph>CAknButton::ELongPressEndedEvent</codeph> is
reported.</p>
<p>To define the period for which the button needs to be held down for a long-tap
event, use the method <xref href="jar:GUID-759FBC7F-5384-4487-8457-A8D4B76F6AA6.jar!/html/classCAknButton.html#5b5323936073f454e96847337131030a" format="application/java-archive"><codeph>SetLongPressInterval()</codeph></xref> in the class <xref href="jar:GUID-759FBC7F-5384-4487-8457-A8D4B76F6AA6.jar!/html/classCAknButton.html" format="application/java-archive"><codeph>CAknButton</codeph></xref>.</p>
<codeblock xml:space="preserve">void CMyAppContainer::ConstructL() 
{ 

iButton = CAknButton::NewL( NULL, NULL, NULL, NULL, 

KNullDesC, KNullDesC , KAknButtonReportOnLongPress, 0 ); 

iButton-&gt;SetContainerWindowL( *this ); 
iButton-&gt;SetObserver( this ); 

} 

void CMyAppContainer::HandleControlEventL( CCoeControl* aControl, 
                                                  TCoeEvent aEventType ) 
    { 
        switch ( aEventType ) 
            { 

// Button is pressed for a long time 

            case CAknButton::ELongPressEvent: 
                        if ( aControl == iButton ) 

{ 



} 

                break; 

// Button long press ended 

            case CAknButton::ELongPressEndedEvent: 
                        if ( aControl == iButton ) 

{ 



} 

                break; 

            default: 
                break; 
            } 
    } 

</codeblock>
</conbody></concept>