Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

ItemEditIgnore

Defines whether an item is ignored for cell editing.

C

BOOL WINAPI SftTree_GetItemEditIgnore(HWND hwndCtl, int index);
BOOL WINAPI SftTree_SetItemEditIgnore(HWND hwndCtl, int index, BOOL fIgnore);
BOOL WINAPI SftTreeSplit_GetItemEditIgnore(HWND hwndCtl, int index);
BOOL WINAPI SftTreeSplit_SetItemEditIgnore(HWND hwndCtl, int index, BOOL fIgnore);

C++

BOOL CSftTree::GetItemEditIgnore(int index) const;
BOOL CSftTree::SetItemEditIgnore(int index, BOOL fIgnore = TRUE);
BOOL CSftTreeSplit::GetItemEditIgnore(int index) const;
BOOL CSftTreeSplit::SetItemEditIgnore(int index, BOOL fIgnore = TRUE);

Parameters

hwndCtl

The window handle of the tree control.

index

The zero-based index of the item for which the cell editing value is to be retrieved or set.

fIgnore

Set to TRUE to mark the item as non-editable, otherwise set to FALSE.

Returns

GetItemEditIgnore returns a value indicating whether an item is ignored for cell editing. TRUE is returned if the item is not used for cell editing, otherwise FALSE.

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

Comments

The GetItemEditIgnore and SetItemEditIgnore functions define whether an item is ignored for cell editing.

The tree control doesn't control cell editing, which is always performed by the application. The value defined using SetItemEditIgnore is not used by the tree control in any way, but can be used by the application during cell editing and navigation to determine whether certain items need to be ignored during cell editing, i.e., they cannot be edited.

Individual cells can be ignored for cell editing using the SFTTREE_CELL structure's flag2 member (SFTTREECELL_EDITIGNORE).

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

Examples

C

    SFTTREE_CELLINFOPARM CellInfo;

    /* Make the cell completely visible */
    SftTree_MakeCellVisible(g_hwndTree, index, col);
    /* Get the location */
    if (!SftTree_GetDisplayCellRect(g_hwndTree, index, col, TRUE, &rect, NULL))
        return;

    if (SftTree_GetItemEditIgnore(g_hwndTree, index))
        return; // this item can't be edited
    CellInfo.version = 7;
    CellInfo.index = index;
    CellInfo.iCol = col;
    SftTree_GetCellInfo(g_hwndTree, &CellInfo);
    if (CellInfo.Cell.flag2 & SFTTREECELL_EDITIGNORE)
        return; // this item can't be edited

C++

        m_Tree.SetText(index, 2, _T("3rd Column"));/* Set text in next column */

        index = m_Tree.AddString(_T("Another item"));/* Add another item */
        m_Tree.SetText(index, 1, _T("2nd Column"));/* Set text in next column */
        m_Tree.SetText(index, 2, _T("3rd Column"));/* Set text in next column */
        m_Tree.SetItemLevel(index, 1);/* change level */

        index = m_Tree.AddString(_T("This item can't be edited"));/* Add another item */
        m_Tree.SetItemEditIgnore(index, TRUE);
        m_Tree.SetItemLevel(index, 2);/* change level */
        m_Tree.SetText(index, 1, _T("2nd Column (can't edit this item)"));/* Set text in next column */
        m_Tree.SetText(index, 2, _T("3rd Column (can't edit this item)"));/* Set text in next column */

        index = m_Tree.AddString(_T("A fourth item"));/* Add another item */
        m_Tree.SetItemLevel(index, 1);/* change level */
        m_Tree.SetText(index, 1, _T("This cell can't be edited"));/* Set text in next column */

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