Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
<?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-F2397B5A-0700-46D5-8E07-CBB9F769DA01" xml:lang="en"><title>Getting
user selection from the choice list</title><prolog><metadata><keywords/></metadata></prolog><conbody>
<p>Every time the choice list's status changes, e.g. when the user opens or
closed the list or selects an item from the list, the client application is
informed through the <codeph>MCoeControlObserver</codeph> interface. </p>
<p>Notifications are received by the <codeph>HandleControlEventL</codeph> callback
function in the class <codeph>MCoeControlObserver</codeph>. The event is <codeph>EEventStateChanged</codeph>.</p>
<p>After receiving the event, the client application can use the choice list's <codeph>SelectedIndex</codeph> method
to request if the selection has changed. </p>
<codeblock xml:space="preserve">void CMyAppContainer::HandleControlEventL( CCoeControl* aControl,
TCoeEvent aEventType )
{
if ( aControl == iChoiceList )
{
switch ( aEventType )
{
case EEventStateChanged:
{
TInt newSelection = iChoiceList->SelectedIndex();
if ( iSelection != newSelection )
{
// selected item changed
iSelection = newSelection;
}
}
break;
default:
break;
}
}
}
</codeblock>
</conbody></concept>