×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Regular Contributor
    Join Date
    Jan 2005
    Location
    Malmö, Sweden
    Posts
    157

    Custom background & text color for CBA and StatusPane

    I don't want the theme skin background in my CBA nor in my StatusPane.
    I want to customize it to better fit the background I will have in my view.
    Of course I then also need to control text color.

    How can I do this?

    Is it enough to use CCoeControl::SetBackground to take control of background drawing?

    How to change font color?
    I can't find any obvious API:s to do it...

    Any hints of things to avoid and problems I'm likely to encounter?

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

    Re: Custom background & text color for CBA and StatusPane

    Hi,

    I managed to change the font and color of CBA by ugly tricks.

    http://discussion.forum.nokia.com/fo...69&postcount=2

    http://discussion.forum.nokia.com/fo...91&postcount=4

    Regards

    Ziteng Chen

  3. #3
    Registered User
    Join Date
    Aug 2009
    Posts
    11

    Re: Custom background & text color for CBA and StatusPane

    Hello,

    I am on the same subject, trying to change the CBA's background. From googling I found that I should implement MCoeControlBackground and set it as the CBA's background. Using your HelloWorld example:

    Create a CustomBackground.h
    Code:
    #include <aknapp.h>
    #include <coecntrl.h>
    
    class CustomBackground : public MCoeControlBackground
    	{
    public:
    	void Draw(CWindowGc& aGc, const CCoeControl& aControl, const TRect& aRect) const;
    	};
    And a CustomBackground.cpp as follows:
    Code:
    #include "CustomBackground.h"
    
    void CustomBackground::Draw(CWindowGc& aGc, const CCoeControl& aControl, const TRect& aRect) const
    	{
    	RDebug::Print(_L("CustomBackground::Draw"));
    	aGc.SetPenStyle(CGraphicsContext::ENullPen);
    	aGc.SetBrushColor(KRgbWhite);
    	aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
    	aGc.DrawRect(aRect);
    	}
    In CHelloWorldAppUi::HandleTestMenuItemSelectedL I've set:
    Code:
    ...
    if(bgc!=NULL)
    		{
    		CustomBackground* cbaBackground = new CustomBackground;
    		bgc->SetBackground(cbaBackground);
    		CEikButtonGroupContainer::TUse use = bgc->ButtonGroupType();
    		if(use==CEikButtonGroupContainer::ECba)
    ...

    But the CBA's background remains the same (the theme's background).

    What else do I need to do in order to change the CBA's background?

    Regards,
    Rúben

    EDIT: I am using S60 3rd edition
    Last edited by rcabaco; 2009-08-20 at 18:17. Reason: Mention SDK edition

  4. #4
    Regular Contributor
    Join Date
    Mar 2007
    Posts
    119

    Re: Custom background & text color for CBA and StatusPane

    Why use dirty tricks when there is a nice API for these purposes?

    Code:
    MAknsSkinInstance* pSkin = AknsUtils::SkinInstance();
    
    if(pSkin) 
    {
    	item = AknsUtils::CreateBitmapItemDefL(KAknsIIDQsnBgAreaControl, KFilePath, EMbmSomeSoftkeys);
    
    	pSkin->SetLocalItemDefL( item );
    }

  5. #5
    Registered User
    Join Date
    Aug 2009
    Posts
    11

    Re: Custom background & text color for CBA and StatusPane

    Hi,

    alav that worked quite well. Thank you.

    I have a new problem now, I created a bmp with 240x33 size to use on the CBA. This works fine but the button's text is hidden on the device. The emulator show both the background image and the text correctly.

    Any ideas?

    Rúben

  6. #6
    Registered User
    Join Date
    Aug 2009
    Posts
    11

    Re: Custom background & text color for CBA and StatusPane

    I found out how to fix the problem, through one of alav's posts:
    http://discussion.forum.nokia.com/fo...d.php?t=104019

    Just wanted to know if this is actually necessary or the problem is elsewhere?


    Regards,
    Rúben

  7. #7
    Registered User
    Join Date
    Aug 2009
    Posts
    11

    Re: Custom background & text color for CBA and StatusPane

    Is there a way to change the global font settings for the CBA?

    I managed to change the font for the current buttons, following the HelloWorld example, but when a CBA button is pressed the font definitions used are the default. I understand why this happens, I'm setting the font definition for the currently displayed buttons.

    I can't seem to find a way to change this for the whole application.

    Any thoughts?

    Regards,
    Rúben

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

    Re: Custom background & text color for CBA and StatusPane

    Hi,

    For those who are still looking for the solution to change the CBA background:

    I managed to override the CBA background skin by SetLocalItemDefL(), see the following post:

    http://discussion.forum.nokia.com/fo...89&postcount=2

    Note the code works well on S60 3rd Edition FP2/S60 5th Edition, but not verified on previous editions.

    and for the CBA text color please refer to:

    "How to change the color of font on the status pane and CBA? "
    http://www.newlc.com/en/forum/how-ch...s-pane-and-cba

    but still no idea how to change the CBA font (text size etc.) completely.

    Regards

    Ziteng Chen

Similar Threads

  1. Changing Title Pane Text
    By Symbian_Neil in forum Symbian User Interface
    Replies: 21
    Last Post: 2009-03-06, 12:17
  2. Text of StatusPane changes when screen resolution changes
    By Ishibo San in forum Symbian User Interface
    Replies: 4
    Last Post: 2006-12-14, 15:04
  3. StatusPane text without resources
    By uh...ok in forum Symbian
    Replies: 5
    Last Post: 2006-04-11, 10:52
  4. StatusPane and text
    By Jeepy in forum Symbian
    Replies: 1
    Last Post: 2002-12-06, 02:19

Posting Permissions

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