Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

CellEditWindow

Returns the window containing the specified cell in a split tree control.

C

HWND WINAPI SftTree_GetCellEditWindow(HWND hwndCtl, int index, int realCol);
HWND WINAPI SftTreeSplit_GetCellEditWindow(HWND hwndCtl, int index, int realCol);

C++

CWnd* CSftTree::GetCellEditWindow(int index, int realCol = 0) const;
CWnd* CSftTreeSplit::GetCellEditWindow(int index, int realCol = 0) const;

Parameters

hwndCtl

The window handle of the tree control.

index

The zero-based index of the cell for which the window is to be retrieved.

realCol

The zero-based column number of the cell for which the window is to be retrieved.

Returns

The return value is the window (handle) of the left or right pane of a split tree control or the window (handle) of the tree control if no splitter bar is used.

Comments

The GetCellEditWindow function returns the window containing the specified cell in a split tree control.

This function is used for cell editing. Controls such as edit control or combo boxes which are created by the application for cell editing are created with the tree control as the parent window. When a split tree control is used, the control must be attached to the left or right pane, not the tree control. GetCellEditWindow is used to determine the window (handle) of the left or right pane. AdjustCellEditRect is used to calculate the coordinates for the control relative to the left or right pane.

GetCellEditWindow has no effect in a tree control without splitter bar. But it is recommended to use GetCellEditWindow in case the application is later converted to use a split tree control.

Examples

C

    /* Change selection style to not shown anything */
    SftTree_SetNoFocusStyle(g_hwndTree, SFTTREE_NOFOCUS_NOTHING);

    /* Copy the text found in the tree control */
    SftTree_GetTextCol(g_hwndTree, m_editIndex, m_editCol, szBuffer);

    SftTree_AdjustCellEditRect(g_hwndTree, m_editIndex, m_editCol, &rect);
    EditParent = SftTree_GetCellEditWindow(g_hwndTree, m_editIndex, m_editCol);

    // based on font height, get best height for the control used for cell editing
    hFont = (HFONT) SendMessage(g_hwndTree, WM_GETFONT, 0, 0);
    {
        int diff;
        TEXTMETRIC tm;
        HDC hDC = GetDC(NULL);
        hFont = (HFONT)SelectObject(hDC, hFont);

C++

    /* Change selection style to not shown anything */
    m_Tree.SetNoFocusStyle(SFTTREE_NOFOCUS_NOTHING);

    /* Copy the text found in the tree control */
    CString str;
    m_Tree.GetText(m_editIndex, m_editCol, str);

    m_Tree.AdjustCellEditRect(m_editIndex, m_editCol, &rect);
    CWnd* pEditParent = m_Tree.GetCellEditWindow(m_editIndex, m_editCol);

    // based on font height, get best height for the control used for cell editing
    CFont* pFont = m_Tree.GetFont();

    int diff;
    TEXTMETRIC tm;
    CDC* pDC = GetDC();    

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