Professional UI Solutions
Site Map   /  Register


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 General Discussion » Report grid Collapse All
Subject Author Date
Raja S Feb 11, 2009 - 10:22 AM


I am using the report grid in my application. Grid is getting updated dynamically once in every 5 seconds. Also whenever it is upadated, we sort the rows/coumns of the grid.

It causes a problem when I moving around the grid with up/down arrow keys, control randomly jumps from one row to the another row(e.g. 5th row to 1st row).

Following is the initialization of that reprot grid.


ReportGridModifyStyle(0, __ERGS_COLLAPSE_AFTER_REGROUPING, false );

ReportGridModifyStyle(__ERGS_BOLD_GROUPS, 0, false);

ReportGridModifyStyle(0, __EGBS_SF_MASK, false);

ReportGridModifyStyle(__EGBS_SFM_ROWS, 0, false);

ReportGridModifyStyle(__EGBS_MULTI_AREA_SELECTION, 0, false);

ReportGridModifyStyle(__EGBS_LBEXT_SELECTION, 0, false);

SiwScrollTypeHSet(__ESIS_STH_PIXEL, false);

Please let me know how to fix this problem.



Raja S Feb 20, 2009 - 5:09 PM

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 );








Technical Support Feb 23, 2009 - 7:24 AM

Most of the methods in Prof-UIS grid classes have the bRedraw flag parameter with the true default parameter value. The CExtReportGridWnd::ReportColumnAdjustTextAlignmentH() method used in your code snippet is such method. You should invoke all such methods with the bRedraw flag parameter set to false. Please do not modify internal properties of report grid like m_nHelerLockOnSwUpdateScrollBars, m_nHelerLockEnsureVisibleColumn and m_nHelerLockEnsureVisibleRow. They are needed for preventing automatic updating of grid’s scroll bars during sorting/grouping. Your code restores focused state of some report row, but does not restore the scrolling position. The group rows become re-created during sorting/grouping. So, you also need to save/restore the scrolling position (use the CExtScrollWnd::ScrollPos32Get() and CExtScrollWnd::ScrollPos32Set() methods).

Technical Support Feb 16, 2009 - 12:08 PM

The focus may jump if the report grid updating code removes the focused row. Please provide us with some details about what is performed each 5 seconds? It would be helpful to take a look at the source code which updates the report grid control each 5 seconds.

Raja S Feb 16, 2009 - 11:20 AM


Kindly respond to this query.