Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » wndTreeGrid Collapse All
Subject Author Date
Phil Davis Sep 5, 2006 - 4:14 PM

in a tree grid, is it possible to automatically have the color of the text change in a CellString when the cell is selected. For example, when the cell is selected, the color of the selection indicator is dark blue and the underlying text is black, making the contrast very poor. Can the color be changed to say white automatically, or do I have to do this manually?

Thanks for all help.

Phil Davis Sep 6, 2006 - 4:02 PM

Hi,

thank you for your prompt response.

I am using CExtTreeGridWnd and most of my cells are CellString.

If I do the following, similar to what you suggest:

        //pCell->TextColorSet( CExtGridCell::__ECS_ALL, txtColor );
        pCell->TextColorSet( CExtGridCell::__ECS_NORMAL, txtColor );
        pCell->TextColorSet( CExtGridCell::__ECS_SELECTED, RGB(255,255,255) );
        pCell->TextColorSet( CExtGridCell::__ECS_HOVERED, RGB(255,255,255) );

The program crashes.

If I change the program to:


        pCell->TextColorSet( CExtGridCell::__ECS_ALL, txtColor );
        //pCell->TextColorSet( CExtGridCell::__ECS_NORMAL, txtColor );
        pCell->TextColorSet( CExtGridCell::__ECS_SELECTED, RGB(255,255,255) );
        pCell->TextColorSet( CExtGridCell::__ECS_HOVERED, RGB(255,255,255) );

It does not crash, however, hover does not appear to work and I am not sure if select works.

If I single click on a cell the text remains txtcolor.
If I double click on a cell the text remains txtcolor.

If I single click so the cell is selected, wait a couple of seconds then click again, the cell goes into edit mode and changes to white.


Technical Support Sep 7, 2006 - 12:58 PM

If you want to set the hover text color, please enable notifications about mouse hover events:

HoverEventsSet( true, false );
HoverHighlightSet( true, false, false, false, true, true );

Technical Support Sep 6, 2006 - 12:25 PM

You can use the CExtGridCell::TextColorSet() method for this:

virtual COLORREF TextColorSet(
 CExtGridCell::e_cell_state_t eCellState,
 COLORREF clr = COLORREF( -1L )
 );
This method sets the text color of the cell for the state specified by eCellState.
The eCellState can be one of the following values:

__ECS_ALL - Associated color used for all cell states.
__ECS_NORMAL - Normal (unselected) state
__ECS_SELECTED - Selected state
__ECS_HOVERED - Hovered state

In your case, you can use __ECS_SELECTED:
pCell->TextColorSet( CExtGridCell::__ECS_SELECTED, RGB(255,255,255));