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 Tech Support » Report grid, counting selected rows, faster way. Collapse All
Subject Author Date
Eric Houvenaghel Oct 14, 2009 - 8:38 AM

In the report grid, Is there a faster way of retrieving the number of selected rows then the following method:

    // Get the first selected row.

    LONG lRowCount = 0;

    LONG lRowDataNo = GetFirstSelectedRowGrid();

    while(lRowDataNo != -1) {

        // Is this row childless?

        if(IsChildlessRowGrid(lRowDataNo)) {

            // Increment the row count.



        // Go to the next selected row.

        lRowDataNo = GetNextSelectedRowGrid(lRowDataNo);


In other words, is there a faster way then to COUNT all of the selected rows?


Technical Support Oct 14, 2009 - 12:23 PM

This method is OK.

But you can also track the selection on the fly. You should override the CExtGridBaseWnd::_SelectionAreaConvert() internal virtual method and keep indices of the selected rows in some map. This virtual method is invoked for converting the new selection rectangles on the fly before grid will store them as parts of selection region.