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 » CExtTreeGridWnd - how to test if anything is selected Collapse All
Subject Author Date
Alastair Watts Sep 14, 2010 - 4:17 AM

 



SelectionGetFirstRowInColumn(0) works but is too slow over 2000 rows.



SelectionIsEmpty() doesn’t when the last item in the list is selected, then deleted


Alastair Watts Sep 20, 2010 - 4:44 AM

Thanks.


 

Technical Support Sep 17, 2010 - 12:28 PM

Thank you for reporting this issue. Here is the fix:

bool CExtTreeGridWnd::ItemFocusSet(
            HTREEITEM hTreeItem,
            LONG nColNo,
            bool bRedraw // = true
            )
{
            __EXT_DEBUG_GRID_ASSERT_VALID( this );
            if( hTreeItem == ItemGetRoot() )
                        return false;
            if( ! ItemFocusIsLocked() )
            {
                        CPoint ptFocus = FocusGet();
                        if( ptFocus.y < 0 || ptFocus.y >= RowCountGet() )
                        {
                                    if( hTreeItem == NULL )
                                                return false;
                        } // if( ptFocus.y < 0 || ptFocus.y >= RowCountGet() )
                        else
                        {
                                    if( hTreeItem == NULL )
                                    {
                                                SelectionUnset( false, false );
                                                FocusUnset( bRedraw );
                                                return true;
                                    }
                                    HTREEITEM htiFocus = ItemGetByVisibleRowIndex( ptFocus.y );
                                    __EXT_DEBUG_GRID_ASSERT( htiFocus != NULL );
                                    if( htiFocus == hTreeItem && nColNo == ptFocus.x )
                                                return false;
                        } // else from if( ptFocus.y < 0 || ptFocus.y >= RowCountGet() )
                        if( ! ItemEnsureExpanded( hTreeItem, false ) )
                                    return false;
                        ptFocus.x = nColNo;
                        ptFocus.y = ItemGetVisibleIndexOf( hTreeItem );
                        __EXT_DEBUG_GRID_ASSERT( ptFocus.y >= 0 );
                        if( bRedraw )
                                    OnSwUpdateScrollBars();
                        FocusSet( ptFocus, bRedraw, true, true, bRedraw );
            } // if( ! ItemFocusIsLocked() )
            else
            {
                        if( bRedraw )
                        {
                                    OnSwUpdateScrollBars();
                                    OnSwInvalidate( true );
                        } // if( bRedraw )
            } // else from if( ! ItemFocusIsLocked() )
            return true;
}


Alastair Watts Sep 14, 2010 - 6:48 AM

I tried your suggestion, however, it behaves the same as SelectionIsEmpty().  Let me explain:


If I select the last row in a CExtTreeGridWnd, then delete it using ItemRemove() so that nothing is now selected, the above methods report that something is still selected.


 

Technical Support Sep 14, 2010 - 5:39 AM

The CExtGridBaseWnd::SelectionGetAreaCount() and CExtGridBaseWnd::SelectionGet() methods allow you to walk through rectangular parts of the selected cell region. The CExtGridBaseWnd::SelectionRangeGet() method returns the selected cell region as an CExtGR2D object. You can use the CExtGR2D::IsEmpty() method to detect whether the region is empty.