×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 26
  1. #1
    Super Contributor
    Join Date
    Jun 2008
    Posts
    593

    Smile Change background and highlighed text background of a Listbox..

    hi...

    i want to change the background of the listbox..

    i use the following code..
    Code:
    AknsUtils::SetAvkonSkinEnabledL(EFalse);
    & it gives me white background.. can i display an image instead?

    & by default the text is highlighted by lavender color..
    can i change this color.. or display an image there??

    Thanks
    Nital Shah

  2. #2
    Registered User
    Join Date
    Jun 2007
    Location
    Mumbai, India
    Posts
    1,998

    Re: Change background and highlighed text background of a Listbox..

    To display an image or custom color you will have to override the draw funtion of listbox. Search for CListItemDrawer() DrawActualItem for more hints in the forum.

  3. #3
    Super Contributor
    Join Date
    Jun 2008
    Posts
    593

    Re: Change background and highlighed text background of a Listbox..

    thanks...

    i think den i ll have to customize the whole thing..

    but can i get the original code of DrawActualItem() ..
    so that i can knw where to make changes regarding the background...

  4. #4
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,026

    Re: Change background and highlighed text background of a Listbox..

    look for this function TBool AknsDrawUtils::Background()

    also go through the link:

    http://wiki.forum.nokia.com/index.ph...tem_background
    Last edited by vineet.jain; 2009-10-06 at 11:58.

  5. #5
    Registered User
    Join Date
    Jun 2007
    Location
    Mumbai, India
    Posts
    1,998

    Re: Change background and highlighed text background of a Listbox..

    Hi Nital,

    Follow the link provided by Vineet. It seems to a better option in your case rather than using the one I suggested.

  6. #6
    Super Contributor
    Join Date
    Jun 2008
    Posts
    593

    Re: Change background and highlighed text background of a Listbox..

    hi vineet...
    Thanks for yr help..

    the link u provided works fine for highlighted item's back color...

    & for changing the background color of the list view..
    i did this...
    Code:
    void Draw( const TRect& aRect ) const
    	{
    	CWindowGc& gc = SystemGc();
    	gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
    	gc.SetPenStyle(CGraphicsContext::ESolidPen);  
    	gc.SetBrushColor(KRgbRed);
    	gc.DrawRect(aRect);
    	
    	MAknsSkinInstance* skin = AknsUtils::SkinInstance();
    	AknsDrawUtils::Background(skin,iListBox->ItemDrawer()->SkinBackgroundControlContext(),gc,aRect);
    	
    	}
    but this doesnt reflect any changes done..

    can u plz say where m wrong?

    Thnks..

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

    Re: Change background and highlighed text background of a Listbox..

    Hi,

    On S60 3rd Edition the list-box is fully skinned, and the list-box item background is actually an image that is stitched together by nine small images (four edges, four corners and the central image). See the "how-to" wiki article:

    "How to change the highlighted listbox item background"
    http://wiki.forum.nokia.com/index.ph...tem_background

    Regards

    Ziteng Chen

  8. #8
    Super Contributor
    Join Date
    Jun 2008
    Posts
    593

    Post Re: Change background and highlighed text background of a Listbox..

    actually i have already implemented changing highlighted text background color thru the provided link...

    but now i need help for changing the total background image...
    i went thru many threads but dey r all left incomplete..

    plz guide me thru...

    Thanks
    Nital

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

    Re: Change background and highlighed text background of a Listbox..

    Hi,

    Glad to hear that the tip works for you. I think you can override the listbox background skin in the same way, and I guess the skin id required is KAknsIIDQsnBgAreaMainListGene.

    Regards

    Ziteng Chen

  10. #10
    Super Contributor
    Join Date
    Jun 2008
    Posts
    593

    Unhappy Re: Change background and highlighed text background of a Listbox..

    Quote Originally Posted by chenziteng View Post
    Hi,

    Glad to hear that the tip works for you. I think you can override the listbox background skin in the same way, and I guess the skin id required is KAknsIIDQsnBgAreaMainListGene.

    Regards

    Ziteng Chen
    hi..
    i implemented as u said.. i only changed the skin ID to KAknsIIDQsnBgAreaMainListGene
    (also checked for KAknsIIDQsnBgAreaMainListSet)
    but doesnt reflect any changes...

    Code:
    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
        CAknsItemData* item = skin->GetCachedItemData(KAknsIIDQsnBgAreaMainListGene);
        if(item==NULL)
            {
            item = skin->CreateUncachedItemDataL(KAknsIIDQsnBgAreaMainListGene);
            }
        if(item->Type()==EAknsITMaskedBitmap)
            {
            CAknsItemDef* def = AknsUtils::CreateMaskedBitmapItemDefL(KAknsIIDQsnBgAreaMainListGene, KTdjgmcqeFile, EMbmTdjgmcqeListboxitemhightlightcenter, EMbmTdjgmcqeListboxitemhightlightcentermask);
            skin->SetLocalItemDefL(def);
            }
    any thing else to add or change??

  11. #11
    Super Contributor
    Join Date
    Jun 2008
    Posts
    593

    Smile Re: Change background and highlighed text background of a Listbox..

    Quote Originally Posted by chenziteng View Post
    Hi,

    Glad to hear that the tip works for you. I think you can override the listbox background skin in the same way, and I guess the skin id required is KAknsIIDQsnBgAreaMainListGene.

    Regards

    Ziteng Chen
    hey sorry.. it works fine

    this is how i ve done it..
    Code:
      MAknsSkinInstance* skin = AknsUtils::SkinInstance();
        skin->SetChangeEventsEnabled(ETrue);
        CAknsItemData* item = skin->GetCachedItemData(KAknsIIDQsnBgAreaMainListGene   );
        if(item==NULL)
           {
           item = skin->CreateUncachedItemDataL(KAknsIIDQsnBgAreaMainListGene   );
           }
      if(item->Type()!=EAknsITMaskedBitmap);
            {
            CAknsItemDef* def = AknsUtils::CreateMaskedBitmapItemDefL(KAknsIIDQsnBgAreaMainListGene   , KTdjgmcqeFile, EMbmTdjgmcqeListboxitemhightlightcenter, EMbmTdjgmcqeListboxitemhightlightcentermask);
            skin->SetLocalItemDefL(def);
            }
    Thanks a Lot for yr precious help!!

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

    Re: Change background and highlighed text background of a Listbox..

    Hi,

    Yes it also works for me see the wiki article:

    "How to use custom background for listbox "
    http://wiki.forum.nokia.com/index.ph...nd_for_listbox

    Regards

    Ziteng Chen

  13. #13
    Super Contributor
    Join Date
    Jun 2008
    Posts
    593

    Red face Re: Change background and highlighed text background of a Listbox..

    it works fine wen Status pane is USUAL or NULL

    but wen i try wid "R_AVKON_STATUS_PANE_LAYOUT_SMALL".. the listbox background is not affected...

    can u plz suggest how can i overcome it...

    Thanks
    Nital

  14. #14
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,026

    Re: Change background and highlighed text background of a Listbox..

    hi nital, try changing the skin id's according to the status pane size, they are all menitoned in sdk

  15. #15
    Super Contributor
    Join Date
    Jun 2008
    Posts
    593

    Re: Change background and highlighed text background of a Listbox..

    Quote Originally Posted by vineet.jain View Post
    hi nital, try changing the skin id's according to the status pane size, they are all menitoned in sdk
    hey..
    but there r only 2 IDs given for changing listbackgroun..

    KAknsIIDQsnBgAreaMainListGene & KAknsIIDQsnBgAreaMainListSet

    i tried both.. but no success

Posting Permissions

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