Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

Text

Defines an item's cell text.

C

int SftTree_GetTextCol(HWND hwndCtl, int index, int realCol, LPTSTR lpszBuffer);
int SftTree_GetText(HWND hwndCtl, int index, LPTSTR lpszBuffer);
int WINAPI SftTree_GetText_A(HWND hwndCtl, int index, LPSTR lpszBuffer);
int WINAPI SftTree_GetText_W(HWND hwndCtl, int index, LPWSTR lpszBuffer);
BOOL SftTree_SetTextCol(HWND hwndCtl, int index, int realCol, LPCTSTR lpszBuffer);
BOOL SftTree_SetText(HWND hwndCtl, int index, LPCTSTR lpszBuffer);
BOOL WINAPI SftTree_SetText_A(HWND hwndCtl, int index, LPCSTR lpszBuffer);
BOOL WINAPI SftTree_SetText_W(HWND hwndCtl, int index, LPCWSTR lpszBuffer);
int SftTreeSplit_GetTextCol(HWND hwndCtl, int index, int realCol, LPTSTR lpszBuffer);
int SftTreeSplit_GetText(HWND hwndCtl, int index, LPTSTR lpszBuffer);
int WINAPI SftTreeSplit_GetText_A(HWND hwndCtl, int index, LPSTR lpszBuffer);
int WINAPI SftTreeSplit_GetText_W(HWND hwndCtl, int index, LPWSTR lpszBuffer);
BOOL SftTreeSplit_SetTextCol(HWND hwndCtl, int index, int realCol, LPCTSTR lpszBuffer);
BOOL SftTreeSplit_SetText(HWND hwndCtl, int index, LPCTSTR lpszBuffer);
BOOL WINAPI SftTreeSplit_SetText_A(HWND hwndCtl, int index, LPCSTR lpszBuffer);
BOOL WINAPI SftTreeSplit_SetText_W(HWND hwndCtl, int index, LPCWSTR lpszBuffer);

C++

void CSftTree::GetText(int index, int realCol, CString& string) const;
void CSftTree::GetText(int index, CString& string) const;
int CSftTree::GetText(int index, int realCol, LPTSTR lpszBuffer) const;
int CSftTree::GetText(int index, LPTSTR lpszBuffer) const;
BOOL CSftTree::SetText(int index, int realCol, LPCTSTR lpszBuffer);
BOOL CSftTree::SetText(int index, LPCTSTR lpszBuffer);
void CSftTreeSplit::GetText(int index, int realCol, CString& string) const;
void CSftTreeSplit::GetText(int index, CString& string) const;
int CSftTreeSplit::GetText(int index, int realCol, LPTSTR lpszBuffer) const;
int CSftTreeSplit::GetText(int index, LPTSTR lpszBuffer) const;
BOOL CSftTreeSplit::SetText(int index, int realCol, LPCTSTR lpszBuffer);
BOOL CSftTreeSplit::SetText(int index, LPCTSTR lpszBuffer);

Parameters

hwndCtl

The window handle of the tree control.

index

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

realCol

The zero-based column number whose text is to be retrieved or set.

lpszBuffer

A pointer to a buffer containing the item's text or where the item's cell text will be returned.

string

A reference to a CString object where the item's cell text will be returned.

Returns

GetText(Col) returns the number of characters returned in the buffer, not including the terminating '\0'. The buffer must be large enough to receive the complete text. GetTextLen can be used to determine the buffer length needed. -1 is returned if an error occurred.

SetText(Col) returns TRUE if the function was successful, otherwise FALSE is returned.

Comments

The GetText and SetText functions define an item's cell text.

The text retrieved is based on the column specified using realCol or last defined using SetAccessColumn. Functions, which do not allow the realCol parameter, access the column last defined by SetAccessColumn or the last column referenced by a column specific function. The last column accessed can be retrieved using GetAccessColumn.

In a tree control using a virtual data source, SetText(Col) cannot be used and an error is returned. The alpszString member of the SFTTREE_ITEM structure is used instead.

Examples

C

        /*------------------------------------------------------------------------------*/
        /* Add a few items.                                                             */
        /*------------------------------------------------------------------------------*/

        {
            int index;

            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);

C++

    /*------------------------------------------------------------------------------*/
    /* Add a few items.                                                             */
    /*------------------------------------------------------------------------------*/

    {
        int index;

        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);

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