Symbian3/SDK/Source/GUID-462239D1-4B40-4342-92DA-32AB0AF0D2F2.dita
changeset 0 89d6a7a84779
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Symbian3/SDK/Source/GUID-462239D1-4B40-4342-92DA-32AB0AF0D2F2.dita	Thu Jan 21 18:18:20 2010 +0000
@@ -0,0 +1,73 @@
+<?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-462239D1-4B40-4342-92DA-32AB0AF0D2F2" xml:lang="en"><title>Creating
+the choice list</title><prolog><metadata><keywords/></metadata></prolog><conbody>
+<p>To use a choice list in your application, create an instance of the class <codeph>CAknChoiceList</codeph>. </p>
+<p>Use the <codeph>CAknChoiceList::NewL</codeph> parameters to set the style
+of the choice list.</p>
+<p>If you give no parameters, the defaults will be used. With the default
+parameters, a choice list with current selection is constructed.</p>
+<p>To construct a choice list without a current selection, use the flag <codeph>CAknChoiceList::EaknChoiceListWithoutCurrentSelection</codeph> and
+an instance of <codeph>CaknButton</codeph> in the constructor. This button
+will be then used to open the choice list. The ownership of the button is
+transferred to the choice list.</p>
+<p>The following sample code illustrates creating a default choice list.</p>
+<codeblock xml:space="preserve">const TInt KArrayGranularity ( 1 );
+ 
+   // Create array of choice list items        
+    CDesCArrayFlat* array = new ( ELeave ) CDesCArrayFlat ( KArrayGranularity );
+    CleanupStack::PushL( array );
+    
+    _LIT( KListItem, "Item %d" );
+
+    for ( TInt k = 0; k &lt; 5; k++ )
+        {
+        TBuf&lt;32&gt; buf;
+        buf.Format( KListItem, k );
+        array-&gt;AppendL( buf );
+        }
+ 
+    // Create choice list with array
+    iChoiceList = CAknChoiceList::NewL( this, array );
+    
+    CleanupStack::Pop( array );
+    
+    iChoiceList-&gt;SetObserver( this );
+</codeblock>
+<p>The following sample code illustrates creating a button choice list with
+items from resources:</p>
+<codeblock xml:space="preserve"> _LIT( KButtonTxt, "Choice list" );
+    _LIT( KButtonHelpTxt, "Button help text" );
+
+    // Create a button for the choice list
+    CAknButton* button = CAknButton::NewLC( NULL,
+                                            NULL,
+                                            NULL,
+                                            NULL,
+                                            KButtonTxt,
+                                            KButtonHelpTxt,
+                                            KAknButtonSizeFitText,
+                                            0 );
+ 
+    // Create empty Choice list
+    iChoiceList = CAknChoiceList::NewL( this, NULL, 
+        CAknChoiceList::EAknChoiceListWithoutCurrentSelection, button );
+    CleanupStack::Pop( button );
+ 
+    // Add items from resource
+    iChoiceList-&gt;SetItemsL( R_CHOICELISTEX_ITEM_ARRAY );
+    iArraySize = ArraySizeL( R_CHOICELISTEX_ITEM_ARRAY );
+    iSelection = 0;
+    
+    iChoiceList-&gt;SetObserver( this );
+</codeblock>
+</conbody></concept>
\ No newline at end of file