diff -r 43e37759235e -r 51a74ef9ed63 Symbian3/SDK/Source/GUID-62DF565C-8121-429F-99D0-B5FBDE634AA9.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-62DF565C-8121-429F-99D0-B5FBDE634AA9.dita Wed Mar 31 11:11:55 2010 +0100 @@ -0,0 +1,78 @@ + + + + + +Using +long-tap events +

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.

+

To receive long-tap events, use the class CAknLongTapDetector in the Touch +UI utilities API.

+

To enable the handling of long tap events in your CAknButton , +set the flag KAknButtonReportOnLongPress for the button. +When the long tap event starts,CAknButton::ELongPressEvent() is +reported to the button observer (MCoeControlObserver). When +the long tap event ends, CAknButton::ELongPressEndedEvent() is +reported.

+

To define the period for which the button needs to be held down for a long-tap +event, use the method SetLongPressInterval() in the class CAknButton.

+void CMyAppContainer::ConstructL() +{ +… +iButton = CAknButton::NewL( NULL, NULL, NULL, NULL, + +KNullDesC, KNullDesC , KAknButtonReportOnLongPress, 0 ); + +iButton->SetContainerWindowL( *this ); +iButton->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; + } + } + + +
\ No newline at end of file