<< Return to Main Index

< Return to Class Index

CGXGridCore::m_bRefreshOnSetCurrentCell

BOOL m_bRefreshOnSetCurrentCell;

Remarks

Specifies whether cells need to be redrawn when they become the current cell in the grid. If you set this attribute to be TRUE, some grid internal optimization that outline the current without redrawing the cell are turned off. These optimizations assume that the style of a cell does not change when it has become the current cell (and so, only a border would be drawn around the cell without redrawing it).

You may set m_bRefreshOnSetCurrentCell also for a specific type of control only. If you have for example a password-control which should be drawn with plain text only when it is the current cell, you may set the m_bRefreshOnSetCurrentCell attribute of the specific control to be TRUE. Other controls will then not be affected.

Example

This example shows you how to change the appearance of the current cell:

BOOL CBrowserView::GetStyleRowCol(ROWCOL nRow, ROWCOL nCol, CGXStyle& style, GXModifyType mt, int nType)
{
   if (!base_class::GetStyleRowCol(nRow, nCol, style, mt, nType))
      return FALSE;

   // You may also initialize the following attribute
   // in your OnInitialUpdate method.
   m_bRefreshOnSetCurrentCell = TRUE;    // always redraw current cell when moved

   // Check if this is the current cell
   if (!IsPrinting( ) && nRow > 0 && nCol > 0 && nRow == m_nOutlineRow)
   {
      // NOTE: This is only an example. You may customize the
      // behavior to your specific needs. Using the grid's default
      // outlining of the current cell will probably look better
      // than this sample (has a nicer border).

      if (IsCurrentCell(nRow, nCol))
      {
         // draw background of cell red
         style.SetInterior(RGB(255,0,0));

         // draw border in highlight around current cell
         style.SetBorders(gxBorderAll,
            CGXPen( ).SetWidth(1).SetColor(COLOR_HIGHLIGHT));

         // NOTE: If you want to do this, you should disable
         // the default outlining of the current cell by placing
         // the following lines in your OnInitialUpdate routine:
         //
         // CGXProperties* pProp = GetParam( )->GetProperties( );
         // pProp->SetUserProperty(GX_IDS_OUTLINECURRENTCELL,
         //      (CGXStyle) pProp->sInvertNoBorder);
      }
   }

   return TRUE;
}

See Also

CGXControl::m_bRefreshOnSetCurrentCell

CGXGridCore

Class Overview | Class Members