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 » HTREEITEM from row | CExtTreeGridWnd Collapse All
Subject Author Date
Massimo Germi Mar 31, 2006 - 9:11 AM

Hi,
How can I retrieve HTREEITEM of an item if I know row number?
I’ve created a CExtTreeGridWnd derived class and I’ve override a OnGridCellButtonPressed funcion.
I wish to send WN_NOTIFY message, to parent Window, where I can handle the pressed button of a cell.
bool CMyTreeGrid::OnGridCellButtonPressed(
        CExtGridCell & _cell,
        INT nButtonType,
        const RECT & rcCellExtra,
        const RECT & rcCell,
        LONG nVisibleColNo,
        LONG nVisibleRowNo,
        LONG nColNo,
        LONG nRowNo,
        INT nColType,
        INT nRowType
        )
{
    CWnd* pWnd = GetParent();
    ASSERT_VALID(pWnd);
    if(pWnd)
    {
        NMTREEVIEW nmtreeview;
        nmtreeview.hdr.hwndFrom = m_hWnd;
        nmtreeview.hdr.code = WM_MY_MESSAGE;
        nmtreeview.hdr.idFrom = GetDlgCtrlID();
        nmtreeview.itemNew.hItem = ????????????; I DON’T ABLE TO RETRIEVE HTREEITEM

        pWnd->SendMessage(WM_NOTIFY,(WPARAM)GetDlgCtrlID(),(LPARAM)&nmtreeview);
    }

    return CExtGridWnd::OnGridCellButtonPressed(_cell,nButtonType,rcCellExtra,rcCell,
        nVisibleColNo,nVisibleRowNo,nColNo,nRowNo,nColType,nRowType);
}

Thanks a lot


Technical Support Apr 2, 2006 - 5:43 AM

The following methods of the CExtTreeGridWnd class allow you to get the HTREEITEM handle from a row number and vica versa according to the current expanded/collapsed state of the tree grid row:

virtual HTREEITEM ItemGetByVisibleRowIndex( LONG nRowNo ) const;
LONG ItemGetVisibleIndexOf( HTREEITEM hTreeItem ) const;
The latter method returns -1 if at least one parent item of the specified item is collapsed.