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:
| -
|