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 CExtTreeGridCellNode::TreeNodeGetFirstChild() Collapse All
Subject Author Date
Andrey Karavashkin Oct 17, 2006 - 1:40 PM

CExtTreeGridWnd::ItemGetFirstChild
"Returns a handle of the first item in the list of child items with the specified parent." (c) PROF-UIs 2.60 help

But lower level function checks m_pNodeParent variable != NULL before return first child.
So Root Item’s childs will never returns.

CExtTreeGridCellNode * CExtTreeGridCellNode::TreeNodeGetFirstChild()
{
    ASSERT_VALID( this );
    if( m_pNodeParent == NULL )
        return NULL;
    ASSERT_VALID( m_pNodeParent );
    return /*m_pNodeParent->*/ TreeNodeGetChildAt( 0 );
}


as result this code
    HTREEITEM a_Item = ItemGetRoot();
    a_Item = ItemGetFirstChildAt(a_Item);
a_Item variable will ALWAYS == NULL, because no parent for Root item.


Workaround:
    ItemGetChildAt(ItemGetRoot(), 0)
works as expected.

Technical Support Oct 21, 2006 - 11:28 AM

Thank you for reporting the bug. It can be fixed by upding the following methods:

CExtTreeGridCellNode * CExtTreeGridCellNode::TreeNodeGetFirstChild()
{
    ASSERT_VALID( this );
    return TreeNodeGetChildAt( 0 );
}
 
const CExtTreeGridCellNode * CExtTreeGridCellNode::TreeNodeGetFirstChild() const
{
    ASSERT_VALID( this );
    return TreeNodeGetChildAt( 0 );
}
 
CExtTreeGridCellNode * CExtTreeGridCellNode::TreeNodeGetLastChild()
{
    ASSERT_VALID( this );
    return TreeNodeGetChildAt( TreeNodeGetChildCount() - 1 );
}
 
const CExtTreeGridCellNode * CExtTreeGridCellNode::TreeNodeGetLastChild() const
{
    ASSERT_VALID( this );
    return TreeNodeGetChildAt( TreeNodeGetChildCount() - 1 );
}