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 » Were you able to reproduce this bug? Collapse All
Subject Author Date
Offer Har Sep 23, 2008 - 9:36 AM
Technical Support Sep 25, 2008 - 12:49 PM

This behavior is provided by implementation of the CExtGridCell::OnQueryTextColor virtual method in the CExtGridCellComboBox class:

COLORREF CExtGridCellComboBox::OnQueryTextColor(
      const CExtGridWnd & wndGrid,
      CDC & dc,
      LONG nVisibleColNo,
      LONG nVisibleRowNo,
      LONG nColNo,
      LONG nRowNo,
      INT nColType,
      INT nRowType,
      DWORD dwAreaFlags,
      DWORD dwHelperPaintFlags
      ) const
{
      ASSERT_VALID( this );
COLORREF clrText = CExtGridCellString::OnQueryTextColor( wndGrid, dc, nVisibleColNo, nVisibleRowNo, nColNo, nRowNo, nColType, nRowType, dwAreaFlags, dwHelperPaintFlags );
      if( clrText != COLORREF(-1L) )
            return clrText;
      if( (dwHelperPaintFlags&__EGCPF_PRINTING_TARGET_MASK) != 0 )
            return COLORREF(-1L);
      if( wndGrid.SelectionGetForCell( nColNo, nRowNo ) )
            return COLORREF( -1L );
LONG nCurSel = GetCurSel();
      if( nCurSel >= 0 )
      {
            clrText = GetItemTextColor( nCurSel );
            if( clrText != COLORREF( -1L ) ) 
                  return clrText;
      }
      return COLORREF( -1L );
}

The button control without handler attached on the dialog is not the source of the problem. You can even not click it and just press TAB key to switch focus from grid window to other dialog control. As you can see in the method’s source code above, if the combo box grid cell is selected, then the default text color is used. This is true independently from the focused state of the grid window. We think the colored text will work like you need if you replace the following lines in the method above:
 if( wndGrid.SelectionGetForCell( nColNo, nRowNo ) )
            return COLORREF( -1L );

With the following:
 if(         nColType == 0
            &&    nRowType == 0
            &&    ( dwHelperPaintFlags & __EGCPF_FOCUSED_CONTROL ) != 0 
            &&    wndGrid.SelectionGetForCellPainting( nColNo, nRowNo )
            )
            return COLORREF( -1L );



Technical Support Sep 24, 2008 - 5:03 AM

We need your help in reproducing this issue. Could you please modify the following simple test project in such a way that we have grid cells like you have in your real project and provide us with exact description of what we should click, press, move, drag and do to see the problem?

http://www.prof-uis.com/download/forums/TestHoveredButtonsForRon.zip

Offer Har Sep 24, 2008 - 8:33 AM

Thanks for the test project - was very helpful.


the problem is only when the cell is in focus the selected color is not displayed.


These are the change I did in your project in CDlg::OnInitDialog, when adding items to the combo-boxes:



            pCell->ModifyStyle(__EGCS_NO_INPLACE_CONTROL);

            COLORREF color[] = { 
                RGB(0,0,255),
                RGB(255,0,0),
                RGB(0,255,0),
                RGB(128,0,0),
                RGB(0,128,0),
                RGB(0,0,128),
                RGB(128,0,128),
                RGB(128,128,0),
                RGB(128,128,128),
                RGB(0,128,128) };
            for( nItemNo = 0L; nItemNo < nItemCount; nItemNo ++ )
            {
                CString s;
                s.Format( _T("Item %d"), nItemNo );
                int nItem = pCell->AddString( LPCTSTR(s) );
                pCell->SetItemTextColor(nItem,color[nItemNo]);
            }

Then do this:


1. Open one of the combos, select any item, each have its own color.


2. When the combo is closed, the color of the item is not displayed


3. Press the button, - the grid loses focus, the item still is in focus, hence, the color if the text is still remain black.


I need in 2& 3 that the text will be displayed in its real color set for the item - how can this problem be fixed?


Thanks,


Ron.