|
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 concept |
|
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
|
12 <concept id="GUID-210606BE-A36C-4B65-B083-93F71024196C" xml:lang="en"><title>Setting |
|
13 the item selected when the choice list is opened</title><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <p>You can set the list item that is initially selected when the choice list |
|
15 is shown to the user. This feature can be used with a choice list of the type <codeph>EAknChoiceListWithCurrentSelection</codeph>. </p> |
|
16 <p>If you do not set the selected item, the first item in the list is initially |
|
17 selected by default.</p> |
|
18 <p>For details on how the choice list items are indexed, see <xref href="GUID-845F3021-E3ED-4676-916A-75740886DCBD.dita">Using |
|
19 the Choice list API</xref>.</p> |
|
20 <codeblock xml:space="preserve">void CMyAppContainer::CreateChoiceListL() |
|
21 { |
|
22 // Create empty Choice list |
|
23 iChoiceList = CAknChoiceList::NewL( this, NULL ); |
|
24 |
|
25 // Add items from resource |
|
26 iChoiceList->SetItemsL( R_CHOICELISTEX_ITEM_ARRAY ); |
|
27 |
|
28 // Set the default selected item |
|
29 iChoiceList->SetSelectedIndex( KDefaultIndex ); |
|
30 |
|
31 iChoiceList->SetObserver( this ); |
|
32 iChoiceList->SetRect( ChoiceListRect() ); |
|
33 } |
|
34 </codeblock> |
|
35 </conbody></concept> |