×
Namespaces

Variants
Actions

How to get the Current Item Text from ListBox

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: User:Kanu123 (30 Jun 2007)
Last edited: hamishwillee (26 Jul 2012)

Headers Required:

#include <aknlists.h> 
#include <badesca.h>

Link against:

LIBRARY avkon.lib eikcoctl.lib eikctl.lib bafl.lib

Source:

// Creating the SingleStyleListBox
iListBox = new (ELeave) CAknSingleStyleListBox();
iListBox->SetContainerWindowL(*this);
iListBox->SetMopParent(this);
iListBox->ConstructL(this,EAknListBoxSelectionList);
 
// Adding some elements to list box
CDesCArrayFlat* array = new (ELeave) CDesCArrayFlat(4);
array->AppendL(_L("\tItem 1"));
array->AppendL(_L("\tItem 2"));
array->AppendL(_L("\tItem 3"));
 
// Setting the List box attributes
iListBox->MakeVisible(true);
iListBox->SetRect(aRect);
iListBox->ActivateL();
iListBox->DrawNow();
 
// Now getting the text of Current Selected Item, itemtext contains the text
// of selected item of list box.
TPtrC itemtext = iListBox->Model()->ItemText(iListBox->CurrentItemIndex());

Related Links

This page was last modified on 26 July 2012, at 06:08.
54 page views in the last 30 days.
×