Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

ItemLevel

Defines an item's level number.

C

int WINAPI SftTree_GetItemLevel(HWND hwndCtl, int index);
BOOL WINAPI SftTree_SetItemLevel(HWND hwndCtl, int index, int level);
int WINAPI SftTreeSplit_GetItemLevel(HWND hwndCtl, int index);
BOOL WINAPI SftTreeSplit_SetItemLevel(HWND hwndCtl, int index, int level);

C++

int CSftTree::GetItemLevel(int index) const;
BOOL CSftTree::SetItemLevel(int index, int level);
int CSftTreeSplit::GetItemLevel(int index) const;
BOOL CSftTreeSplit::SetItemLevel(int index, int level);

Parameters

hwndCtl

The window handle of the tree control.

index

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

level

The new, zero-based level number of the item.

Returns

GetItemLevel returns the level number of the requested item or -1 if an error occurred.

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

Comments

The GetItemLevel and SetItemLevel functions define an item's level number.

If an item is not visible when its level is set, it is automatically made visible by expanding its parent(s). If an item is collapsed when its level is set, it is first automatically expanded.

The root (or highest) level is level 0, dependents are on levels 1, 2, 3 and lower. The lowest level is defined as level SFTTREE_MAXLEVELS (64).

The SetIndentation function can be used to define the exact indentation for item levels.

In a tree control using a virtual data source, SetItemLevel cannot be used and an error is returned. The level member of the SFTTREE_ITEM structure is used instead.

Examples

C

            index = SftTree_AddString(g_hwndTree, TEXT("Progress Bars"));
            SftTree_SetTextCol(g_hwndTree, index, 0, TEXT("SftTree/DLL supports progress bars as cell background (partial or full size)."));

            // add progress bar samples
            {
                SFTTREE_CELLINFOPARM CellInfo;

                int i = SftTree_AddString(g_hwndTree, TEXT("Progress Bar - Full Size"));
                SftTree_SetItemLevel(g_hwndTree, i, 1);
                CellInfo.version = 7;
                CellInfo.index = i;
                CellInfo.iCol = 0;
                SftTree_GetCellInfo(g_hwndTree, &CellInfo);
                CellInfo.Cell.progressMax = 100;    // maximum value 0 - 100
                CellInfo.Cell.progressVal = 33;     // current value
                SftTree_SetCellInfo(g_hwndTree, &CellInfo);

C++

        index = m_Tree.AddString(_T("Progress Bars"));
        m_Tree.SetText(index, 0, _T("SftTree/DLL supports progress bars as cell background (partial or full size)."));

        // add progress bar samples
        {
            SFTTREE_CELLINFOPARM CellInfo;

            int i = m_Tree.AddString(_T("Progress Bar - Full Size"));
            m_Tree.SetItemLevel(i, 1);
            CellInfo.version = 7;
            CellInfo.index = i;
            CellInfo.iCol = 0;
            m_Tree.GetCellInfo(&CellInfo);
            CellInfo.Cell.progressMax = 100;    // maximum value 0 - 100
            CellInfo.Cell.progressVal = 33;     // current value
            m_Tree.SetCellInfo(&CellInfo);

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