Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

RowText

Defines an item's row header text.

C

int SftTree_GetRowText(HWND hwndCtl, int index, LPTSTR lpszBuffer);
int WINAPI SftTree_GetRowText_A(HWND hwndCtl, int index, LPSTR lpszBuffer);
int WINAPI SftTree_GetRowText_W(HWND hwndCtl, int index, LPWSTR lpszBuffer);
BOOL SftTree_SetRowText(HWND hwndCtl, int index, LPCTSTR lpszBuffer);
BOOL WINAPI SftTree_SetRowText_A(HWND hwndCtl, int index, LPCSTR lpszBuffer);
BOOL WINAPI SftTree_SetRowText_W(HWND hwndCtl, int index, LPCWSTR lpszBuffer);
int SftTreeSplit_GetRowText(HWND hwndCtl, int index, LPTSTR lpszBuffer);
int WINAPI SftTreeSplit_GetRowText_A(HWND hwndCtl, int index, LPSTR lpszBuffer);
int WINAPI SftTreeSplit_GetRowText_W(HWND hwndCtl, int index, LPWSTR lpszBuffer);
BOOL SftTreeSplit_SetRowText(HWND hwndCtl, int index, LPCTSTR lpszBuffer);
BOOL WINAPI SftTreeSplit_SetRowText_A(HWND hwndCtl, int index, LPCSTR lpszBuffer);
BOOL WINAPI SftTreeSplit_SetRowText_W(HWND hwndCtl, int index, LPCWSTR lpszBuffer);

C++

void CSftTree::GetRowText(int index, CString& string) const;
int CSftTree::GetRowText(int index, LPTSTR lpszBuffer) const;
BOOL CSftTree::SetRowText(int index, LPCTSTR lpszBuffer);
void CSftTreeSplit::GetRowText(int index, CString& string) const;
int CSftTreeSplit::GetRowText(int index, LPTSTR lpszBuffer) const;
BOOL CSftTreeSplit::SetRowText(int index, LPCTSTR lpszBuffer);

Parameters

hwndCtl

The window handle of the tree control.

index

The zero-based index of the item for which the row header text is to be retrieved or set.

lpszBuffer

A pointer to a buffer where the row header text will be returned (GetRowText) or a buffer containing the new row header text (SetRowText).

string

A reference to a CString object, where the row header text will be returned.

Returns

GetRowText returns the number of characters returned in the buffer, not including the terminating '\0'.

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

Comments

The GetRowText and SetRowText functions define an item's row header text.

GetRowTextLen can be used to determine the required lpszBuffer size.

Row header text may contain multiple lines of text, delimited using cr-lf (\r\n) based on the settings defined using SetRowHeaderLines.

Row headers are made visible using SetShowRowHeader.

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

Examples

C

            index = SftTree_AddString(g_hwndTree, TEXT("An item"));/* Add an item */
            SftTree_SetTextCol(g_hwndTree, index, 1, TEXT("2nd Column"));/* Set text in next column */
            SftTree_SetTextCol(g_hwndTree, index, 2, TEXT("3nd Column"));/* Set text in next column */
            index = SftTree_AddString(g_hwndTree, TEXT("Another item"));/* Add another item */
            SftTree_SetItemLevel(g_hwndTree, index, 1);/* change level */
            SftTree_SetTextCol(g_hwndTree, index, 1, TEXT("2nd Column"));/* Set text in next column */
            SftTree_SetTextCol(g_hwndTree, index, 2, TEXT("3nd Column"));/* Set text in next column */
            /* Set an item's row header text using: */
            SftTree_SetRowText(g_hwndTree, index, TEXT("?"));/* Row header text */

            index = SftTree_AddString(g_hwndTree, TEXT("A third item"));/* Add another item */
            SftTree_SetItemLevel(g_hwndTree, index, 2);/* change level */
            SftTree_SetTextCol(g_hwndTree, index, 1, TEXT("2nd Column"));/* Set text in next column */
            SftTree_SetTextCol(g_hwndTree, index, 2, TEXT("3nd Column"));/* Set text in next column */
            index = SftTree_AddString(g_hwndTree, TEXT("A fourth item"));/* Add another item */
            SftTree_SetItemLevel(g_hwndTree, index, 1);/* change level */

C++

        index = m_Tree.AddString(_T("An item"));/* Add an item */
        m_Tree.SetText(index, 1, _T("2nd Column"));/* Set text in next column */
        m_Tree.SetText(index, 2, _T("3nd Column"));/* Set text in next column */
        index = m_Tree.AddString(_T("Another item"));/* Add another item */
        m_Tree.SetItemLevel(index, 1);/* change level */
        m_Tree.SetText(index, 1, _T("2nd Column"));/* Set text in next column */
        m_Tree.SetText(index, 2, _T("3nd Column"));/* Set text in next column */
        /* Set an item's row header text using: */
        m_Tree.SetRowText(index, _T("?"));/* Row header text */

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

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