Archived:How to change the highlighted listbox item background using Symbian C++
(Created page with '== Overview == On S60 3rd Edition the listbox is fully skinnable, and the listbox item background is actually an image that is stitched together by nine small images (four edges…')
|Line 40:||Line 40:|
Revision as of 08:20, 28 September 2009
On S60 3rd Edition the listbox is fully skinnable, and the listbox item background is actually an image that is stitched together by nine small images (four edges, four corners and the central image). Every part is identified by an ID like the KAknsIIDQsnFrListCenter. You can find the definition of the IDs in the system header file AknsConstants.h.
The following code shows how to override the skin image for listbox highlighted item background (central part) by a self-created bitmap.
const TRect& aRect,
const CCoeControl* aParent,
MEikCommandObserver* aCommandObserver )
_LIT(KMbmFile, "z:\\resource\\apps\\Tdjgmcqe.mbm"); // not good to use a hard-coded path, but anyway this is just a sample code.
MAknsSkinInstance* skin = AknsUtils::SkinInstance();
CAknsItemData* item = skin->GetCachedItemData(KAknsIIDQsnFrListCenter);
item = skin->CreateUncachedItemDataL(KAknsIIDQsnFrListCenter);
CAknsItemDef* def = AknsUtils::CreateMaskedBitmapItemDefL(KAknsIIDQsnFrListCenter, KMbmFile, EMbmTdjgmcqeListboxitemhightlightcenter, EMbmTdjgmcqeListboxitemhightlightcentermask);
// change the highlighted item text color
Full example (you should change the hard-coded mbm path in order to run it on target):