×
Namespaces

Variants
Actions

How to read icons for listbox

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: kiran10182 (07 May 2007)
Last edited: hamishwillee (26 Jul 2012)
The Symbian API contains the helper class CAknIconArray that allows reading icons for the listbox from resources. It uses the AKN_ICON_ARRAY structure.
RESOURCE AKN_ICON_ARRAY r_icon_testIcons
 
{
 
type = EAknIconArraySimple;
 
bmpfile = "z:\SYSTEM\DATA\AVKON.MBM";
 
icons =
 
{
 
AKN_ICON
 
{
 
iconId = EMbmAvkonQgn_indi_checkbox_on;
 
maskId = EMbmAvkonQgn_indi_checkbox_on_mask;
 
},
 
AKN_ICON
 
{
 
IconId = EMbmAvkonQgn_indi_checkbox_off;
 
maskId = EMbmAvkonQgn_indi_checkbox_off_mask;
 
}
 
};
 
}

This resource contains the default icons for checkboxes.

In the source code, call CAknIconArray::ConstructFromResourceL() to construct the icons.


// CAknSingleGraphicStyleListBox* iListbox;
iListbox = new(ELeave)CAknSingleGraphicStyleListBox();
 
iListbox->SetContainerWindowL(*this);
 
TResourceReader reader;
 
CEikonEnv::Static()->CreateResourceReaderLC(reader, R_LIST);
 
iListbox->ConstructFromResourceL(reader);
 
// Creates a GUI icon array.
 
CAknIconArray* icons =new(ELeave) CAknIconArray(2);
 
CleanupStack::PushL(icons);
 
icons->ConstructFromResourceL(R_ICON_TESTICONS);
 
// Sets graphics as ListBox icon.
 
iListbox->ItemDrawer()->ColumnData()->SetIconArray(icons);
 
CleanupStack::Pop(); // icons
 
CleanupStack::PopAndDestroy(); // reader
This page was last modified on 26 July 2012, at 06:17.
60 page views in the last 30 days.
×