Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

DisplayCellRect

Returns the location of a cell.

C

BOOL WINAPI SftTree_GetDisplayCellRect(HWND hwndCtl,
        int index,
        int iCol,
        BOOL fClient,
        LPRECT lpRect,
        int* lpSpan);
BOOL WINAPI SftTreeSplit_GetDisplayCellRect(HWND hwndCtl,
        int index,
        int iCol,
        BOOL fClient,
        LPRECT lpRect,
        int* lpSpan);

C++

BOOL CSftTree::GetDisplayCellRect(int index,
        int iCol,
        BOOL fClient,
        LPRECT lpRect,
        int* lpSpan) const;
BOOL CSftTreeSplit::GetDisplayCellRect(int index,
        int iCol,
        BOOL fClient,
        LPRECT lpRect,
        int* lpSpan) const;

Parameters

hwndCtl

The window handle of the tree control.

index

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

iCol

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

fClient

Set to TRUE to limit the returned rectangle lpRect to the tree control's client area and to adjust for horizontal scrolling. If set to FALSE, the rectangle returned is not clipped to the client area or otherwise adjusted for horizontal scrolling.

lpRect

A pointer to a RECT structure where the location of the cell is returned (in pixels).

lpSpan

A pointer to a variable where the number of columns is returned that the cell occupies. If cell merging is allowed and the cell merges into an adjacent cell, it can span more than one column. This parameter may be NULL.

Returns

GetDisplayCellRect returns TRUE if successful, otherwise FALSE is returned.

Comments

The GetDisplayCellRect function returns the location of a cell.

The RECT structure lpRect describes the location of the specified cell. It can be used for cell editing to create a Windows control of the correct size.

GetCellRectInfoEx can be used to retrieve the coordinates of cell text and cell pictures.

GetItemRect returns the coordinates of an entire item.

Examples

C

    int height;
    HWND EditParent;
    HFONT hFont;
    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;

C++

void CSampleView::StartEdit(int index, int col)
{
    CRect rect;

    /* Make the cell completely visible */
    m_Tree.MakeCellVisible(index, col);
    /* get the item location */
    if (!m_Tree.GetDisplayCellRect(index, col, TRUE, &rect, NULL))
        return;                          /* No column active */

    if (m_Tree.GetItemEditIgnore(index))
        return; // this item can't be edited
    SFTTREE_CELLINFOPARM CellInfo;
    CellInfo.version = 7;
    CellInfo.index = index;
    CellInfo.iCol = col;

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