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 » Report Grid selected item Collapse All
Subject Author Date
Paul Cowan Jun 4, 2007 - 6:58 AM

How do I dtermine the currently selected cell in a CExtReportGridWnd?

Technical Support Jun 5, 2007 - 6:17 AM

There is an article about how to get selected cells (Prof-UIS grids support multiple cell selection). But the approach below may be easier in the case of CExtReportGridWnd.

You can enumerate all the selected cells in column nColNo by using the following code:

LONG nRowNo = m_wndReportGrid.SelectionGetFirstRowInColumn( nColNo );
while( nRowNo >= 0L )
{
    HTREEITEM hTreeItem = 
        m_wndReportGrid.ItemGetByVisibleRowIndex( nRowNo );
    ASSERT( hTreeItem != NULL );
    CExtReportGridItem * pRGI = 
        m_wndReportGrid.ReportItemFromTreeItem( hTreeItem );
    ASSERT( pRGI != NULL );
    ASSERT_VALID( pRGI );

    if( pRGI->TreeNodeGetChildCount() == 0L )
    {
        //
        // Here pRGI is a data cell
        //
    }

    nRowNo = m_wndReportGrid.SelectionGetNextRowInColumn( nColNo, nRowNo );
}
You can use the SelectionGetLastRowInColumn() and SelectionGetPrevRowInColumn() methods for traversing the column in the reversed order from bottom to top.
Alternatevely, you can enumerate all the selected cells in row nRowNo by using:
LONG nColNo = m_wndReportGrid.SelectionGetFirstColumnInRow( nRowNo );
while( nColNo >= 0L )
{
    ...
    nColNo = m_wndReportGrid.SelectionGetNextColumnInRow( nColNo, nRowNo );
}
You can use the SelectionGetLastColumnInRow() and SelectionGetPrevColumnInRow() methods for traversing the same row in the reversed order from right to left.