Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 12:36, 24 August 2007.

TSS000596 - How to retrieve grid text color from the current theme

From Forum Nokia Wiki


Subject:

How to retrieve grid text color from the current theme

TSS000596

 

Platform(s): Device(s), SW version(s):
S60 2nd Edition, S60 3rd Edition  

Category:

Symbian C++

Subcategory:

UI, UI Components

Description:

Description:
The text color for custom grids (CAknGrid) can be retrieved from the current theme. Setting the grid text color is slightly different for S60 2nd Edition and 3rd Edition devices.
Solution:
S60 2nd Edition:
Normal and highlighted text colors can be set in the SizeChanged() function of the CCoeControl-derived container (that owns the grid). The following code demonstrates this:
    TRgb textColor; // text color when not highlighted
    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
    AknsUtils::GetCachedColor( skin, textColor, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG9 );
    TRgb highlightColor; // text color when highlighted
    AknsUtils::GetCachedColor( skin, highlightColor, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG11 );
    iGrid->ItemDrawer()->SetTextColor( textColor ); // iGrid is of type CAknGrid
    iGrid->ItemDrawer()->SetHighlightedTextColor( highlightColor );
However, ItemDrawer()->SetTextColor() cannot be used for S60 3rd Edition and higher.
S60 3rd Edition:
Set the color of a CFormattedCellListBoxData object. This can be done as follows:
    TRgb textColor; // text color when not highlighted
    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
    AknsUtils::GetCachedColor( skin, textColor, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG9 );
    TRgb highlightColor; // text color when highlighted
    AknsUtils::GetCachedColor( skin, highlightColor, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG11 );

    CFormattedCellListBoxData::TColors colors;
    colors.iText = textColor;
    colors.iHighlightedText = highlightColor;
    iGrid->ItemDrawer()->FormattedCellData()->SetSubCellColorsL( 0, colors );
    iGrid->ItemDrawer()->FormattedCellData()->SetSubCellColorsL( 1, colors );
    iGrid->ItemDrawer()->FormattedCellData()->SetSubCellColorsL( 3, colors );
The above code has to be added to the SizeChanged() function of the grid, otherwise the default SizeChanged() implementation will override the custom settings. Also note that the SetUpFormTextCell() method of grid has to be called before trying to set the text colors.

Creation date:

February 22, 2007

Last modified:

-
Related Discussions
Thread Thread Starter Forum Replies Last Post
A Grid and Bar Problem!!!!!plz help... mike_sukh Themes/Carbide.ui 0 2007-01-08 15:21
Active Standby text color on 6680 neillandry Symbian User Interface 0 2006-09-30 22:10
Help with S60 Theme Studio 3 milothomas Graphics & Video & Streaming 0 2006-06-15 06:31
CEikRichTextEditor Text Color relliott97 Symbian User Interface 1 2004-12-08 04:26
How to adjust Font in Gridview? chirag_cel General Symbian C++ 8 2007-12-07 04:41
 
Powered by MediaWiki