Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

Count

Returns the number of items in the tree control.

C

int WINAPI SftTree_GetCount(HWND hwndCtl);
int WINAPI SftTreeSplit_GetCount(HWND hwndCtl);

C++

int CSftTree::GetCount() const;
int CSftTreeSplit::GetCount() const;

Parameters

hwndCtl

The window handle of the tree control.

Returns

The return value is the number of items in the tree control.

Comments

The GetCount function returns the number of items in the tree control.

Examples

C

    // check if header right-clicked - we don't show the context menu there
    SftTree_GetHeaderRect(hwndTree, -1, &rect);
    if (PtInRect(&rect, pt))
        return;

    // check if an item cell right-clicked
    index = SftTree_CalcIndexFromPointEx(hwndTree, &pt);
    if (index >= 0 && index < SftTree_GetCount(hwndTree)) {
        // on an item
        ShowItemMenu(hwndParent, hwndTree, index, x, y);
        return;
    }
}

/*------------------------------------------------------------------------------*/
/* This sample code can be used to implement a sorting callback routine.        */

C++

    // check if header right-clicked - we don't show the popup there
    m_Tree.GetHeaderRect(-1, &rect);
    if (PtInRect(&rect, ptTree))
        return;

    // check if an item cell right-clicked
    index = m_Tree.CalcIndexFromPointEx(&ptTree);
    if (index >= 0 && index < m_Tree.GetCount()) {
        // on an item
        ShowItemMenu(index, pt);
        return;
    }
}

See Also C/C++ API | Categories | Notifications