how to change the color of the Highlight item in the listbox
Hi All,
Iam unable to change the color of the highlight rectangle over the item in the listbox. iam using the listbox type is CAknColumnListBox. The default color is light blue. i want to change it orange color. the code i wrote for it is shown here. iam working on S60 3ed FP1 sdk verstion. any suggestions please??
m_iListBox = new (ELeave) CAknSingleGraphicStyleListBox();
m_iListBox->ConstructL (this, EAknListBoxSelectionList);
m_iListBox->SetContainerWindowL (*this);
m_iListBox->SetListBoxObserver(this);
m_iListBox->SetObserver(this);
m_iListBox->CreateScrollBarFrameL(ETrue);
m_iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto );
m_iListBox->SetFocus(ETrue);
m_iListBox->View()->SetBackColor(TRgb(0,0,0));
m_iListBox->View()->ItemDrawer()->SetBackColor(TRgb(0,0,0));
m_iListBox->ItemDrawer()->SetHighlightedBackColor(TRgb(200,140,20));//orange
//m_iListBox->ItemDrawer()->SetBackColor(TRgb(0,0,0));
//m_iListBox->ItemDrawer()->SetHighlightedBackColor(TRgb(200,140,20));
m_iListBox->ItemDrawer()->ColumnData()->SetColumnFontL(1,CEikonEnv::Static()->AnnotationFont());
m_iListBox->View()->ItemDrawer()->SetTextColor (TRgb(200,140,20));
InitListBox();
SetRect( aRect );
ActivateL();
thanks in advance..
-ravi
Re: how to change the color of the Highlight item in the listbox
[QUOTE=RaveendraB;348877]Hi All,
...
thanks in advance..
-ravi[/QUOTE]
The following statement works on S60 3rd Edition FP1 Emulator.
[code]
iListBox->ItemDrawer()->SetHighlightedTextColor(KRgbRed);
[/code]
Regards
Ziteng Chen
Re: how to change the color of the Highlighted rectangle in the listbox
thanks Ziteng for quick reply. the statement you sent is change the text color itself. but my requirement is to change the color of highlighted rectangle over the text. by default color of the rect is blue and i want to change it to orange color.
Re: how to change the color of the Highlighted rectangle in the listbox
[QUOTE=RaveendraB;349052]thanks Ziteng for quick reply. the statement you sent is change the text color itself. but my requirement is to change the color of highlighted rectangle over the text. by default color of the rect is blue and i want to change it to orange color.[/QUOTE]
Hi,
I'm sorry, I think I was too tired to read it clearly enough to understand it.
To my understanding the highlighted rect is a kind of skin, not pure color.
You can override the skin by the following code:
[code]
// override the center part of the skin
_LIT(KMbmFile, "z:\\resource\\apps\\Tdjgmcqe.mbm");
MAknsSkinInstance* skin = AknsUtils::SkinInstance();
CAknsItemData* item = skin->GetCachedItemData(KAknsIIDQsnFrListCenter);
if(item==NULL)
{
item = skin->CreateUncachedItemDataL(KAknsIIDQsnFrListCenter);
}
if(item->Type()==EAknsITMaskedBitmap)
{
CAknsItemDef* def = AknsUtils::CreateMaskedBitmapItemDefL(KAknsIIDQsnFrListCenter, KMbmFile, EMbmTdjgmcqeListboxitemhightlightcenter, EMbmTdjgmcqeListboxitemhightlightcentermask);
skin->SetLocalItemDefL(def);
}
[/code]
Note that the listbox item highlight skin consists of nine parts, 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".
See the example:
"Tdjgmcqe(ListBoxItemHighlight).zip"
[url]http://wiki.forum.nokia.com/index.php/Image:Tdjgmcqe%28ListBoxItemHighlight%29.zip[/url]
The example is just a concept verfication and is given with no guarantee that it has no bugs.
Regards
Ziteng Chen
Re: how to change the color of the Highlighted rectangle in the listbox
[QUOTE=chenziteng;349285]Hi,
I'm sorry, I think I was too tired to read it clearly enough to understand it.
To my understanding the highlighted rect is a kind of skin, not pure color.
You can override the skin by the following code:
[code]
// override the center part of the skin
_LIT(KMbmFile, "z:\\resource\\apps\\Tdjgmcqe.mbm");
MAknsSkinInstance* skin = AknsUtils::SkinInstance();
CAknsItemData* item = skin->GetCachedItemData(KAknsIIDQsnFrListCenter);
if(item==NULL)
{
item = skin->CreateUncachedItemDataL(KAknsIIDQsnFrListCenter);
}
if(item->Type()==EAknsITMaskedBitmap)
{
CAknsItemDef* def = AknsUtils::CreateMaskedBitmapItemDefL(KAknsIIDQsnFrListCenter, KMbmFile, EMbmTdjgmcqeListboxitemhightlightcenter, EMbmTdjgmcqeListboxitemhightlightcentermask);
skin->SetLocalItemDefL(def);
}
[/code]
Note that the listbox item highlight skin consists of nine parts, 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".
I wrote a simple example and you can download it here:
"Tdjgmcqe(ListBoxItemHighlight).zip"
[url]http://www.gigasize.com/get.php?d=8tftc3zgjcd[/url]
The example is just a concept verfication and is given with no guarantee that it has no bugs.
Regards
Ziteng Chen[/QUOTE]
Hi Ziteng,
iam not able to download ur exmple. please help me.
Re: how to change the color of the Highlight rectangle in the listbox
Hi chenziteng ,
Iam not able to download example you had sent it. while download it shows only filename there is nothing to download .i think it might be content is missing.please help me.
-regards
raveendra
Re: how to change the color of the Highlighted rectangle in the listbox
[QUOTE=RaveendraB;349377]Hi Ziteng,
iam not able to download ur exmple. please help me.[/QUOTE]
Hi,
I've uploaded it to the wiki so this time there should be no problem anymore.
"Tdjgmcqe(ListBoxItemHighlight).zip"
[url]http://wiki.forum.nokia.com/index.php/Image:Tdjgmcqe%28ListBoxItemHighlight%29.zip[/url]
Regards
Ziteng Chen
Re: how to change the color of the Highlight item in the listbox
Hi Ziteng,
Thanks Ziteng. i was able to downloag file. iam able to run your example. it is ok.
thanks a lot for help me. keep in touch me...
-regards
raveendra
Re: how to change the color of the Highlight item in the listbox
Hi All,
Can you help me how to change skin in MenuPane and color of softkeys?
Thanks