Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Jul 2004

    Text color in Grid on S60 v3.1

    For S60 v3.0 and before, the text color in CAknGrid can be set using the well known FileList example's method:

    // Layout of text
    *iGrid, // Reference to grid
    iGrid->ItemDrawer(), // Pointer to the item drawer
    1, // Column index
    fontText, // Font
    215, // Color (215 = black)
    0, // Left margin
    0, // Right margin - unused
    baseline, // Baseline
    iSizeOfCell.iWidth, // Text width
    CGraphicsContext::ECenter, // Text alignment
    TPoint(0, iSizeOfCell.iHeight/2), // Start position
    iSizeOfCell.iHeight)); // End position

    But on 3.1 emulator and N95, even I change the value 215 to 0 or 21500 or any other value, it seems the text color won't change.

    What I want to do is the use the theme's default text color as the text color in the grid. How can I do so??



  2. #2
    Registered User
    Join Date
    Feb 2007

    Re: Text color in Grid on S60 v3.1

    if somebody is still interesting:

    CFormattedCellListBoxData::TColors gridColors = grid->ItemDrawer()->ColumnData()->SubCellColors(0);
    gridColors.iText = iTextColor;
    gridColors.iHighlightedText = iHTextColor;
    grid->ItemDrawer()->ColumnData()->SetSubCellColorsL(0, gridColors);
    One can retrieve default theme colors like this:
    AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), iTextColor,
    KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6);
    AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), iHTextColor,
    KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG11);
    see aknsconstants.h, TAknsQsnTextColorsIndex for comments about EAknsCIQsnTextColorsCG## constants.

  3. #3
    Registered User
    Join Date
    Jul 2008

    Thumbs up Re: Text color in Grid on S60 v3.1


    void CMyGrid::SizeChanged()
        CFormattedCellListBoxData::TColors gridColors = ItemDrawer()->ColumnData()->SubCellColors(0);
        gridColors.iText = TRgb(0xff,0x00,0x00); // unselected grid cell's text
        gridColors.iHighlightedText = TRgb(0x00,0x00,0xff); // selected grid cell's text
        ItemDrawer()->ColumnData()->SetSubCellColorsL(0, gridColors); 
        ItemDrawer()->ColumnData()->SetSubCellColorsL(1, gridColors);
        ItemDrawer()->ColumnData()->SetSubCellColorsL(3, gridColors);
    Here's what I did, draws red on the unselected cell texts, and blue on the one selected text.

    Thanks VERY MUCH for pointing me in the right direction though!!@!11

Similar Threads

  1. What is going on with Vibration on S60?
    By amd_rikus in forum Mobile Java General
    Replies: 3
    Last Post: 2006-06-16, 00:29
  2. Grid Text
    By amitsingh18 in forum Symbian
    Replies: 0
    Last Post: 2005-01-28, 07:46
  3. Replies: 0
    Last Post: 2004-11-24, 18:49
  4. Replies: 0
    Last Post: 2003-07-06, 11:13
  5. How to add static text to grid?
    By memosen80 in forum Symbian
    Replies: 2
    Last Post: 2003-07-03, 07: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