Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

ControlInfo

Defines the tree control's attributes.

C

BOOL WINAPI SftTree_GetControlInfo(HWND hwndCtl, LPSFTTREE_CONTROL lpCtl);
BOOL WINAPI SftTree_SetControlInfo(HWND hwndCtl, LPSFTTREE_CONTROL lpCtl);
BOOL WINAPI SftTreeSplit_GetControlInfo(HWND hwndCtl, LPSFTTREE_CONTROL lpCtl);
BOOL WINAPI SftTreeSplit_SetControlInfo(HWND hwndCtl, LPSFTTREE_CONTROL lpCtl);

C++

BOOL CSftTree::GetControlInfo(LPSFTTREE_CONTROL lpCtl) const;
BOOL CSftTree::SetControlInfo(LPSFTTREE_CONTROL  lpCtl);
BOOL CSftTreeSplit::GetControlInfo(LPSFTTREE_CONTROL lpCtl) const;
BOOL CSftTreeSplit::SetControlInfo(LPSFTTREE_CONTROL lpCtl);

Parameters

hwndCtl

The window handle of the tree control.

lpColors

A pointer to a SFTTREE_CONTROL structure containing the tree control definitions. GetControlInfo uses this structure to return the current color settings. SetControlInfo uses the contents of this structure to define the new settings. The cbSize member of the SFTTREE_CONTROL structure must be initialized to the size of the structure (sizeof(SFTTREE_CONTROL)) before calling GetControlInfo.

Returns

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

Comments

The GetControlInfo and SetControlInfo functions define the tree control's attributes.

To modify a control's attributes, the GetControlInfo function is used to retrieve its current attributes. The SFTTREE_CONTROL structure can then be modified, setting the desired attributes. Finally, the control's attributes are updated by a call to the SetControlInfo function.

If the SetControlInfo function fails, the SFTTREE_CONTROL structure's errorValue member contains an error code, indicating which structure member has caused the failure.

Examples

C

        SftTree_SetOpenEnded(g_hwndTree, FALSE);/* Last column width */
        SftTree_SetShowHeaderButtons(g_hwndTree, TRUE);/* Show column header as buttons */

        /* Define control attributes */
        {
            SFTTREE_CONTROL CtrlInfo;
            memset(&CtrlInfo, 0, sizeof(SFTTREE_CONTROL));
            CtrlInfo.cbSize = sizeof(SFTTREE_CONTROL);
            if (!SftTree_GetControlInfo(g_hwndTree, &CtrlInfo))/* Get current settings */
                ; /* Error handling goes here */
            // You need to create a images for at least the ButtonExpanded and ButtonCollapsed button state
            //Sft_SetPictureBitmap(&CtrlInfo.ButtonExpanded, a_bitmap_handle);
            //Sft_SetPictureBitmap(&CtrlInfo.ButtonCollapsed, a_bitmap_handle);
            
            if (SftTree_GetGDIPlusAvailable(g_hwndTree)) {
                // In this example, we are using GDI+ images.

C++

    m_Tree.SetOpenEnded(FALSE);          /* Last column width */
    m_Tree.SetShowHeaderButtons(TRUE);   /* Show column header as buttons */

    /* Define control attributes */
    {
        SFTTREE_CONTROL CtrlInfo;
        memset(&CtrlInfo, 0, sizeof(SFTTREE_CONTROL));
        CtrlInfo.cbSize = sizeof(SFTTREE_CONTROL);
        if (!m_Tree.GetControlInfo(&CtrlInfo))/* Get current settings */
            _ASSERT(0); /* Error handling goes here */
        // You need to create a images for at least the ButtonExpanded and ButtonCollapsed button state
        //Sft_SetPictureBitmap(&CtrlInfo.ButtonExpanded, a_bitmap_handle);
        //Sft_SetPictureBitmap(&CtrlInfo.ButtonCollapsed, a_bitmap_handle);

        if (m_Tree.GetGDIPlusAvailable()) {
            // In this example, we are using GDI+ images.

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