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 » CExtGridCellString TextSet refresh issue Collapse All
Subject Author Date
Darren Oliver Aug 16, 2007 - 2:27 PM

Dear Tech Support,

Is there a way to redraw the cell? Currently the text is updated only when the mouse is dragged over the cell.

The CExtGridCellString is inside a CExtGridWnd

Thanks

Darren Oliver Aug 17, 2007 - 11:05 AM

Thank you, your solution worked perfectly.

Technical Support Aug 17, 2007 - 6:09 AM

First, you should get rectangular cell coordinates in the grid control’s client coordinate system:

CExtGridWnd & wndGrid = . . .
LONG nColNo = . . .
LONG nRowNo = . . .
CRect rcCellLocation;
      if( ! wndGrid.GridCellRectsGet(
                  nColNo,
                  nRowNo,
                  0,
                  0,
                  NULL,
                  &rcCellLocation
                  )
            )
            return . . .
The CExtGridWnd::GridCellRectsGet() method returns true> if the rcCellLocation rectangle was filled with correct cell rectangle coordinates in the grid’s client coordinate system. This method returns false</codde> if it is not possible to compute cell coordinates (cell at column <code>nColNo column and row nRowNo is outside the visible cell range or method parameters are invalid).

Then you should invalidate the part of the grid control which contains the cell at nColNo and nRowNo
wndGrid.InvalidateRect( &rcCellLocation );
This code delays repainting of grid control’s part which contains the specified grid cell. If you don not need delayed repainting and grid control’s surface on the screen should be updated immediately, then the next line of code should be
 wndGrid.UpdateWindow();
If you want to repaint several cells immediately, you should invoke the UpdateWindow() method only once after all the cells were invalidated.