Symbian3/SDK/Source/GUID-210606BE-A36C-4B65-B083-93F71024196C.dita
author Graeme Price <GRAEME.PRICE@NOKIA.COM>
Fri, 15 Oct 2010 14:32:18 +0100
changeset 15 307f4279f433
parent 0 89d6a7a84779
permissions -rw-r--r--
Initial contribution of the Adaptation Documentation.

<?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-210606BE-A36C-4B65-B083-93F71024196C" xml:lang="en"><title>Setting
the item selected when the choice list is opened</title><prolog><metadata><keywords/></metadata></prolog><conbody>
<p>You can set the list item that is initially selected when the choice list
is shown to the user. This feature can be used with a choice list of the type <codeph>EAknChoiceListWithCurrentSelection</codeph>. </p>
<p>If you do not set the selected item, the first item in the list is initially
selected by default.</p>
<p>For details on how the choice list items are indexed, see <xref href="GUID-845F3021-E3ED-4676-916A-75740886DCBD.dita">Using
the Choice list API</xref>.</p>
<codeblock xml:space="preserve">void CMyAppContainer::CreateChoiceListL()
    {
    // Create empty Choice list
    iChoiceList = CAknChoiceList::NewL( this, NULL );
    
    // Add items from resource
    iChoiceList-&gt;SetItemsL( R_CHOICELISTEX_ITEM_ARRAY );
    
    // Set the default selected item
    iChoiceList-&gt;SetSelectedIndex( KDefaultIndex );
        
    iChoiceList-&gt;SetObserver( this );
    iChoiceList-&gt;SetRect( ChoiceListRect() );
    }
</codeblock>
</conbody></concept>