We update the grid data (item and cells) once in every five seconds( like share market price listing). After updating the grid, we will sort the grid items based on the price values. Update function performs the following.
1. Set the color for all the columns.
for(POSITION pos = ReportColumnGetStartPosition(); pos != NULL;)
{ CExtGridCellEx * pCell = STATIC_DOWNCAST(CExtGridCellEx, ReportItemGetCell( pRGC,pRGI, pRGCE ) );
pCell->TextColorSet( CExtGridCell
::__ECS_ALL,color );
}
2. set the progress cell
CExtGridCellProgress *pProgCell = (CExtGridCellProgress*)ReportItemGetCell(pRGCRepPro, pItem, pRuntime); pProgCell->TextColorsSet(clColor, clBack);
pProgCell->BarColorsSet(clColor, clColor);
pProgCell->TextModeSet( CExtGridCellProgress::eText );
pProgCell->BackColorSet(CExtGridCell::__ECS_ALL, clBack);
pProgCell->ModifyStyle( __EGCS_TA_HORZ_CENTER );
3. Update the item values.
4. Saves the collapsed state.
5. Sorts the items.
m_nHelerLockOnSwUpdateScrollBars ++; m_nHelerLockEnsureVisibleColumn ++; m_nHelerLockEnsureVisibleRow ++; CExtReportGridDataProvider & _DP = _GetReportData();
HTREEITEM htiFocus = ItemFocusGet();
SelectionUnset( false, false );
CPoint ptFocus = FocusGet();
FocusUnset( false );
if( htiFocus != NULL )
{
if( ItemGetChildCount(htiFocus) > 0 ) htiFocus = NULL; }
if( ! _DP.ReportSortOrderUpdate( this ) ) { m_nHelerLockOnSwUpdateScrollBars --; m_nHelerLockEnsureVisibleColumn --; m_nHelerLockEnsureVisibleRow --; return false; }//sort ....
CExtReportGridColumn *pRGC = ReportColumnGetNext(pos);
DWORD dwAlignment = pRGC->GetStyle() & __EGCS_TA_HORZ_MASK;
ReportColumnAdjustTextAlignmentH(pRGC, dwAlignment);
m_nHelerLockOnSwUpdateScrollBars --;
m_nHelerLockEnsureVisibleColumn --;
m_nHelerLockEnsureVisibleRow --;
if(htiFocus != NULL ){
ItemEnsureExpanded( htiFocus );
ItemGetVisibleIndexOf( htiFocus );
OnSwRecalcLayout( true );
OnSwUpdateScrollBars();
}