×
Namespaces

Variants
Actions

Using CAknIconArray to read icons for listbox from resources

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

The article is believed to be still valid for the original topic scope.


Article Metadata
Compatibility
Platform(s): S60 1st Edition
S60 2nd Edition
S60 2nd Edition (initial release)
S60 1st Edition
Article
Created: User:Technical writer 2 (04 Feb 2004)
Last edited: lpvalente (11 Jun 2014)

Overview

Using CAknIconArray to read icons for listbox from resources

Description

The Symbian API contains the helper class CAknIconArray that allows reading icons for the listbox from resources. It uses the AKN_ICON_ARRAY structure. Could you provide an example of how this functionality is used?

Solution

Fill in the resource the following way:
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 11 June 2014, at 20:14.
74 page views in the last 30 days.
×