×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Sep 2004
    Posts
    33

    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
    Last edited by RaveendraB; 2007-10-05 at 06:08. Reason: change the description more clearly.

  2. #2
    Nokia Developer Champion
    Join Date
    May 2004
    Posts
    2,266

    Re: how to change the color of the Highlight item in the listbox

    Quote Originally Posted by RaveendraB View Post
    Hi All,
    ...
    thanks in advance..

    -ravi
    The following statement works on S60 3rd Edition FP1 Emulator.

    Code:
    iListBox->ItemDrawer()->SetHighlightedTextColor(KRgbRed);
    Regards

    Ziteng Chen

  3. #3
    Registered User
    Join Date
    Sep 2004
    Posts
    33

    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.
    Last edited by RaveendraB; 2007-10-05 at 10:32.

  4. #4
    Nokia Developer Champion
    Join Date
    May 2004
    Posts
    2,266

    Re: how to change the color of the Highlighted rectangle in the listbox

    Quote Originally Posted by RaveendraB View Post
    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.
    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);
            }
    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"
    http://wiki.forum.nokia.com/index.ph...ghlight%29.zip

    The example is just a concept verfication and is given with no guarantee that it has no bugs.

    Regards

    Ziteng Chen
    Last edited by chenziteng; 2009-01-26 at 05:17.

  5. #5
    Registered User
    Join Date
    Sep 2004
    Posts
    33

    Re: how to change the color of the Highlighted rectangle in the listbox

    Quote Originally Posted by chenziteng View Post
    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);
            }
    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"
    http://www.gigasize.com/get.php?d=8tftc3zgjcd

    The example is just a concept verfication and is given with no guarantee that it has no bugs.

    Regards

    Ziteng Chen

    Hi Ziteng,
    iam not able to download ur exmple. please help me.

  6. #6
    Registered User
    Join Date
    Sep 2004
    Posts
    33

    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

  7. #7
    Nokia Developer Champion
    Join Date
    May 2004
    Posts
    2,266

    Re: how to change the color of the Highlighted rectangle in the listbox

    Quote Originally Posted by RaveendraB View Post
    Hi Ziteng,
    iam not able to download ur exmple. please help me.
    Hi,

    I've uploaded it to the wiki so this time there should be no problem anymore.

    "Tdjgmcqe(ListBoxItemHighlight).zip"
    http://wiki.forum.nokia.com/index.ph...ghlight%29.zip

    Regards

    Ziteng Chen
    Last edited by chenziteng; 2009-01-26 at 05:18.

  8. #8
    Registered User
    Join Date
    Sep 2004
    Posts
    33

    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

  9. #9
    Registered User
    Join Date
    Aug 2007
    Posts
    2

    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

Similar Threads

  1. How to open a Container from a ListBox Item?
    By jennie in forum Symbian User Interface
    Replies: 5
    Last Post: 2007-09-11, 07:37
  2. Cannot read from listbox item array
    By Acemaker in forum Symbian
    Replies: 6
    Last Post: 2007-07-14, 17:43
  3. Change view when selecting item in listbox
    By ninidotnet in forum Symbian User Interface
    Replies: 0
    Last Post: 2006-04-20, 05:59
  4. How to Highlight item in ListBox.........
    By platinnum in forum Symbian
    Replies: 1
    Last Post: 2005-05-19, 14:25
  5. Change color of listbox item
    By anoopd in forum Symbian User Interface
    Replies: 2
    Last Post: 2005-03-09, 08:33

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •