BOOL LockUpdate(BOOL b = TRUE);
b
Specifies if updating the display should be enabled or stopped.
The previous lock-update-state.
Call this method if you have several subsequent commands which will change the grid. Normally each command will update the grid (or invalidate the affected rectangle) immediately, which will result in slowing down performance substantially. If you call LockUpdate( ), subsequent commands need not invalidate the grid (and compute cell/window coordinates). After doing your series of commands, you should call LockUpdate(FALSE) and Redraw( ) to refresh the whole grid (see the example).
This example illustrates how to use LockUpdate:
void CMyGridView::OnFormatResizecols( )
{
// if there are no cells selected,
// copy the current cell's coordinates
CGXRangeList selList;
if (!CopyRangeList(selList, TRUE))
return;
CGXLongOperation theOp;
ResetCurrentCell( );
BeginTrans(GXGetAppData( )->strmResizeCols);
// stop updating the display for subsequent commands
BOOL bLockOld = LockUpdate(TRUE);
TRY
{
// series of commands
// (ResizeColWidthsToFit will do a lot of SetColWidth commands)
POSITION pos = selList.GetHeadPosition( );
while (pos)
{
if (!ResizeColWidthsToFit(selList.GetNext(pos)))
AfxThrowUserException( );
}
CommitTrans( );
}
CATCH(CUserException, e)
{
Rollback( );
}
END_CATCH
// Now, refresh the whole grid
LockUpdate(bLockOld);
Redraw( );
}
Class Overview | Class Members
Class Overview | Class Members