Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

Create

Creates a tree control window and attaches it to the CSftTree or CSftTreeSplit object.

C++

BOOL CSftTree::Create(
        DWORD dwStyle,
        const RECT& rect,
        CWnd* pParentWnd,
        UINT nID);
BOOL CSftTree::CreateEx(
        DWORD dwExStyle,
        DWORD dwStyle,
        const RECT& rect,
        CWnd* pParentWnd,
        UINT nID);
BOOL CSftTreeSplit::Create(
        DWORD dwStyle,
        const RECT& rect,
        CWnd* pParentWnd,
        UINT nID);
BOOL CSftTreeSplit::CreateEx(
        DWORD dwExStyle,
        DWORD dwStyle,
        const RECT& rect,
        CWnd* pParentWnd,
        UINT nID);

Parameters

dwExStyle

Specifies the extended window style of the tree control.

dwStyle

Specifies the window style of the tree control.

rect

Specifies the tree control size and position. Can be either a CRect object or a RECT structure.

pParentWnd

Specifies the tree control's parent window.

nID

Specifies the tree's control ID.

Returns

The return value is TRUE if the function was successful, otherwise FALSE is returned.

Comments

The Create and CreateEx functions define a tree control window and attach it to the CSftTree or CSftTreeSplit object.

Examples

C

            lpCell->flag |= SFTTREE_BMP_RIGHT;/* Cell picture alignment */
        }
        if (col == 2 && (index % 5) == 0) {/* Randomly change colors */
            lpCell->colorBg = 0x80000000 | COLOR_BTNFACE;
            lpCell->colorFg = 0x80000000 | COLOR_BTNTEXT;
        }
    }

    // (Optional) Create row header information
    m_WorkingItem.lpszRowHeader = NULL;  /* Row header text (can be NULL) */
    m_WorkingItem.lpRow = &rowInfo;      /* Row header information (can be NULL) */
    rowInfo.colorBg = rowInfo.colorFg =  /* Row header colors */
        rowInfo.colorBgSel = rowInfo.colorFgSel = SFTTREE_NOCOLOR;
    if ((index % 8) == 0) {/*randomly add bitmaps */
        Sft_SetPictureBitmap(&rowInfo.RowPicture1, m_hRowBitmap);/* Row header picture */
        rowInfo.flag = SFTTREE_BMP_LEFT; /* Row header picture alignment */

C++

/////////////////////////////////////////////////////////////////////////////
// CSampleView message handlers

int CSampleView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    if (CView::OnCreate(lpCreateStruct) == -1)
        return -1;

    if (!m_Tree.CreateEx(
        WS_EX_CLIENTEDGE,
        SFTTREESTYLE_NOTIFY |            /* Notify parent window */
        SFTTREESTYLE_LEFTBUTTONONLY |    /* Only respond to left mouse button */
        SFTTREESTYLE_SCROLL |            /* Honor WS_H/VSCROLL */
        SFTTREESTYLE_DISABLENOSCROLL |   /* Disable scrollbars instead of hiding */
        WS_HSCROLL | WS_VSCROLL |        /* Vertical and horizontal scrollbars */
        WS_VISIBLE | WS_CHILD,           /* Visible, child window */

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