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 » Bug in RowRemove Collapse All
Subject Author Date
Offer Har Apr 16, 2007 - 8:04 AM

Dear Support,
I have a grid in which a button removes the current focused row.
All works well unless the grid have only one row (which is focused of-course)
This is the code I invoke:

bool CMyGrid::Remove()
{
    CPoint pt = FocusGet();
    if (-1==pt.x)
    {
        return false;
    }

    RowRemove(pt.x);
    if (RowCountGet()==1)
    {
        FocusSet(CPoint(1,0), true, true, true, false);
    }

    OnSwDoRedraw();
    
    return true;
}


The assert and failure is here:


LONG CExtGridWnd::RowRemove(
    LONG nRowNo,
    LONG nRowRemoveCount, // = 1L // -1 - remove up to end (truncate)
    bool bRedraw // = true
    )
{
    ASSERT_VALID( this );
    if( ExternalDataGet() )
    {
        ASSERT( FALSE );
        return false;
    }
LONG nRowCount = RowCountGet();
    if( nRowRemoveCount < 0 )
        nRowRemoveCount = nRowCount;
    if(        nRowNo < 0
        ||    (nRowNo+nRowRemoveCount) > nRowCount
        )
    {
        ASSERT( FALSE ); <----- HERE IT FAILS
        return false;
    } // if( nRowNo < 0 ...


Please fix this problem.

Regards,
Ron.

Technical Support Apr 17, 2007 - 10:00 AM

The problem is in this line:

m_wndGrid.RowRemove( pt.x );
You are trying to remove the row at pt.x, but actually pt.x is a column position. Please note CPoint(1,0) specifies second column and first row.

Offer Har Apr 17, 2007 - 10:03 AM

Got you...
So I should do:
m_wndGrid.RowRemove( pt.y );
Correct?...

Technical Support Apr 17, 2007 - 10:10 AM

Yes.