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 » Problem in CExtTreeCtrl::TreeItemRectsGet Collapse All
Subject Author Date
Darlene Gariepy Jan 19, 2012 - 11:01 AM

CExtTreeCtrl::TreeItemRectsGet in ExtControlsCommon.cpp has a bug where the pRectCheckBox parameter may not be set under certain conditions.

Existing Code:

if( _TII.m_eCheckBoxType != e_cbt_none )
{
INT nCheckBoxWidth = OnTreeItemCalcCheckBoxAreaWidth();
rcCheckBox.right += nCheckBoxWidth;
if( pRectCheckBox != NULL )
(*pRectCheckBox) = rcCheckBox;
}


Modified Code:

if( _TII.m_eCheckBoxType != e_cbt_none )
{
INT nCheckBoxWidth = OnTreeItemCalcCheckBoxAreaWidth();
rcCheckBox.right += nCheckBoxWidth;
if( pRectCheckBox != NULL )
(*pRectCheckBox) = rcCheckBox;
} else {
if( pRectCheckBox != NULL )
(*pRectCheckBox) = CRect (0, 0, 0, 0);
}

Technical Support Jan 24, 2012 - 4:03 AM

Thank you for this issue report. We think it’s better to initialize all the non-NULL rectangles nearly beginning of the CExtTreeCtrl::TreeItemRectsGet() method:

    if( pRectEntire != NULL )
        pRectEntire->SetRect( 0, 0, 0, 0 );
    if( pRectLinesArea != NULL )
        pRectLinesArea->SetRect( 0, 0, 0, 0 );
    if( pRectExpandCollapseButton != NULL )
        pRectExpandCollapseButton->SetRect( 0, 0, 0, 0 );
    if( pRectCheckBox != NULL )
        pRectCheckBox->SetRect( 0, 0, 0, 0 );
    if( pRectIcon != NULL )
        pRectIcon->SetRect( 0, 0, 0, 0 );
    if( pRectLabel != NULL )
        pRectLabel->SetRect( 0, 0, 0, 0 );
    if( pRectControl != NULL )
        pRectControl->SetRect( 0, 0, 0, 0 );
    if( pRectRightPart != NULL )
        pRectRightPart->SetRect( 0, 0, 0, 0 );