This document describes how to handle the Middle Soft Key (MSK) and Enter keys in AVKON lists.
If an application handles the list targeted MSK or Enter Key events (EKeyOK and EKeyEnter), for example, in the ProcessKeyEventL() function, the handling of these key events must be moved to the listbox observer function HandleListBoxEventL(). The MSK or Enter Key event related action must be performed when an EEventEnterKeyPressed event is received. This way the list item-specific action is performed on a key event only when there is an option highlighted in the list.
Remove key event handling code from ProcessKeyEventL.
TBool CLogsDetailView::ProcessKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) { if( aType == EEventKey ) { switch( aKeyEvent.iCode ) { ... //------ Remove this code------------- // case EKeyOK: // case EKeyEnter: // Select key pressed // CmdContextMenuL(); // return ETrue; //-------------------------------------- ... default: break; } }
Add key event handling code to HandleListBoxEventL.
void CLogsBaseView::HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType) { ... switch ( aEventType ) { ... //---------Add MSK and enter key handling code---------------- case EEventEnterKeyPressed: { TInt commandId( Cba()->ButtonGroup()->CommandId( CEikButtonGroupContainer::EMiddleSoftkeyPosition ) ); ProcessCommandL( commandId ); break; } //-------------------------------------------------------------- ... default: // HW key shortcuts break; } } ... }
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.