Symbian3/PDK/Source/GUID-D7E279EE-05F5-4E82-AF25-1E10FF50FABA.dita
changeset 5 f345bda72bc4
child 14 578be2adaf3e
equal deleted inserted replaced
4:4816d766a08a 5:f345bda72bc4
       
     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 task
       
    11   PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
       
    12 <task id="GUID-D7E279EE-05F5-4E82-AF25-1E10FF50FABA" xml:lang="en"><title>Handling
       
    13 the Middle Soft Key and Enter Key in AVKON lists</title><shortdesc>This document describes how to handle the Middle Soft Key (MSK)
       
    14 and Enter keys in AVKON lists.</shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody>
       
    15 <context id="GUID-F94E9859-C7AE-45FA-80DC-F62625C32EA4">       <p>If an application
       
    16 handles the list targeted MSK or Enter Key events (<codeph>EKeyOK</codeph> and <codeph>EKeyEnter</codeph>),
       
    17 for example, in the <codeph>ProcessKeyEventL()</codeph> function, the handling
       
    18 of these key events must be moved to the listbox observer function <codeph>HandleListBoxEventL()</codeph>.
       
    19 The MSK or Enter Key event related action must be performed when an <codeph>EEventEnterKeyPressed</codeph> event
       
    20 is received. This way the list item-specific action is performed on a key
       
    21 event only when there is an option highlighted in the list.</p>     </context>
       
    22 <example><ul>
       
    23 <li><p>Remove key event handling code from <codeph>ProcessKeyEventL</codeph>.</p><codeblock xml:space="preserve">TBool CLogsDetailView::ProcessKeyEventL(
       
    24 const TKeyEvent&amp; aKeyEvent,
       
    25 TEventCode aType )
       
    26 {
       
    27   if( aType == EEventKey )
       
    28   {
       
    29     switch( aKeyEvent.iCode )
       
    30     {
       
    31       ...
       
    32 //------ Remove this code-------------
       
    33 <b>// 	case EKeyOK:
       
    34 // 	case EKeyEnter:
       
    35 //	Select key pressed
       
    36 // 	CmdContextMenuL();
       
    37 // 	return ETrue;
       
    38 
       
    39 </b>//--------------------------------------        
       
    40        ...
       
    41         default:
       
    42         break;
       
    43     }
       
    44   }
       
    45 </codeblock></li>
       
    46 <li><p>Add key event handling code to <codeph>HandleListBoxEventL</codeph>.</p><codeblock xml:space="preserve">void CLogsBaseView::HandleListBoxEventL(
       
    47 CEikListBox* aListBox,
       
    48 TListBoxEvent aEventType)
       
    49 {
       
    50   ...
       
    51     switch ( aEventType )
       
    52   {
       
    53     ...
       
    54 //---------Add MSK and enter key handling code----------------<b> 
       
    55       case EEventEnterKeyPressed:
       
    56     {
       
    57       TInt commandId( Cba()-&gt;ButtonGroup()-&gt;CommandId(
       
    58         CEikButtonGroupContainer::EMiddleSoftkeyPosition ) );
       
    59       ProcessCommandL( commandId );
       
    60       break;
       
    61     }
       
    62 </b>//-------------------------------------------------------------- 
       
    63  ...
       
    64       default:
       
    65 // HW key shortcuts
       
    66       break;
       
    67   }
       
    68 }
       
    69 
       
    70 
       
    71 ...
       
    72 }
       
    73 </codeblock></li>
       
    74 </ul></example>
       
    75 </taskbody></task>