Week 23 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 2714, Bug 462.
<?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-4A66B46E-8A23-42E4-ADAD-B124A36B180A" xml:lang="en"><title>Showing
and hiding stylus pop-up menu</title><prolog><metadata><keywords/></metadata></prolog><conbody>
<p>Use the method <xref href="jar:GUID-759FBC7F-5384-4487-8457-A8D4B76F6AA6.jar!/html/classCAknStylusPopUpMenu.html#2aab09ce484efcf807cb1191dbd08062" format="application/java-archive"><codeph>ShowMenu()</codeph></xref> in the class <xref href="jar:GUID-759FBC7F-5384-4487-8457-A8D4B76F6AA6.jar!/html/classCAknStylusPopUpMenu.html" format="application/java-archive"><codeph>CAknStylusPopUpMenu</codeph></xref> to show the stylus pop-up menu.</p>
<p>Usually, the pop-up menu must not be directly displayed in the <codeph>HandlePointerEventL</codeph> of
a <codeph>CCoeControl</codeph>. Use the <codeph>CAknLongTapDetector</codeph>
to handle the Llong Tap event and show the pop-up on the <codeph>HandleLongTapEventL</codeph>,
which is the implementation to the interface <codeph>MAknLongTapDetectorCallBack</codeph>.</p>
<p>The following code snippets illustrates how to show pop-up menu:</p>
<codeblock xml:space="preserve">CAknLongTapDetector * iLongTapDetector;
// "this" implement the interface MAknLongTapDetectorCallBack
iLongTapDetector = CAknLongTapDetector::NewL( this );
// pass the process to the long tap detector
void XXXX::HandlePointerEventL(
const TPointerEvent& aPointerEvent)
{
iLongTapDetector->PointerEventL( aPointerEvent );
// Call base class HandlePointerEventL()
CCoeControl::HandlePointerEventL(aPointerEvent);
}
// handle long tap detector event to show the stylus popup
void XXXX::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& aPenEventScreenLocation )
{
iPopupMenu->SetPosition(
aPenEventScreenLocation ,
CAknStylusPopUpMenu::EPositionTypeRightBottom );
iPopupMenu->ShowMenu();
}
</codeblock>
</conbody></concept>