Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

ItemShown

Defines an item's visibility status.

C

BOOL WINAPI SftTree_GetItemShown(HWND hwndCtl, int index);
BOOL WINAPI SftTree_SetItemShown(HWND hwndCtl, int index, BOOL fShown);
BOOL WINAPI SftTreeSplit_GetItemShown(HWND hwndCtl, int index);
BOOL WINAPI SftTreeSplit_SetItemShown(HWND hwndCtl, int index, BOOL fShown);

C++

BOOL CSftTree::GetItemShown(int index) const;
BOOL CSftTree::SetItemShown(int index, BOOL fShown = TRUE);
BOOL CSftTreeSplit::GetItemShown(int index) const;
BOOL CSftTreeSplit::SetItemShown(int index, BOOL fShown = TRUE);

Parameters

hwndCtl

The window handle of the tree control.

index

The zero-based index of the item for which the visibility status is to be retrieved or set.

fShown

Set to TRUE to make the item visible. An item is made visible by expanding all its parent items. Set to FALSE to hide the item. An item is hidden by collapsing its immediate parent item.

Returns

GetItemShown returns a value indicating the current visibility status of the specified item, TRUE if the item is visible (the parent item is expanded), FALSE if the item is not visible (the parent item is collapsed).

SetItemShown returns TRUE if the function was successful, otherwise FALSE is returned.

Comments

The GetItemShown and SetItemShown functions define an item's visibility status.

An item's visibility status can be retrieved using GetItemShown. Even if an item is considered "visible", it may not actually be shown, because it doesn't fall inside the area of items currently shown in the tree control's client area. Use MakeRowVisible to make the item visible to the user.

Items without parent items cannot be hidden. They always remain visible.

GetNextShown and GetPrevShown can be used to retrieve the next or previous visible item.

In a tree control using a virtual data source, SetItemShown cannot be used and an error is returned.

Examples

C

        if (index < 0)
            index = lastShown;
        if (index > lastShown)
            index = 0;

        col = SftTree_GetRealColumn(g_hwndTree, dispCol);

        // make sure the item is shown
        if (SftTree_GetItemShown(g_hwndTree, index)) {
            // make sure the column is really displayed
            if (lpCol[col].width > 0) {

                // back at m_editIndex, m_editCol?
                if (m_editIndex == index && m_editCol == col) {
                    StartEdit(index, col);
                    return;

C++

        if (index < 0)
            index = lastShown;
        if (index > lastShown)
            index = 0;

        col = m_Tree.GetRealColumn(dispCol);

        // make sure the item is shown
        if (m_Tree.GetItemShown(index)) {
            // make sure the column is really displayed 
            if (lpCol[col].width > 0) {

                // back at m_editIndex, m_editCol?
                if (m_editIndex == index && m_editCol == col) {
                    StartEdit(index, col);
                    return;

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