Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

SFTTREE_CONTROL Structure

The SFTTREE_CONTROL structure is used with GetControlInfo and SetControlInfo to retrieve and set a tree control's attributes.

typedef struct tagSftTreeControl {

    /* Modifiable fields */
    int cbSize; // structure size

    BOOL fGridHorizontalFull;         // full width horizontal lines (when grid lines enabled)
    BOOL fSelectEnabledItemsOnly;           // only enabled items are selectable
    BOOL fRowColumnHeaderColorsOverrideTheme;// true if the row/column header's colors override Windows themes colors
    BOOL fRowColumnFooterColorsOverrideTheme;// true if the row/column footer's colors override Windows themes colors

    int iMouseOverTransitionEffect;   // enable expand/collapse button transition effect when the mouse enters/leaves the tree control
    int nCharSearchMaxInterval;       // interval after which search starts over, if there are no characters typed 
    int iFlybyStyle;                        // Flyby highlighting style
#define SFTTREE_FLYBY_NONE          0
#define SFTTREE_FLYBY_COL1          1
#define SFTTREE_FLYBY_ALLCOLUMNS    2
    int autoExpandHoverInterval;      // 0 or interval after which items are expanded (mouse hover)
    int toolTipTimeOn;                // 0 or interval after which tooltip appears
    int toolTipTimeOff;               // 0 or interval after which tooltip is removed

    SFT_PICTURE ButtonExpanded;       // Expand/collapse button images
    SFT_PICTURE ButtonCollapsed;
    SFT_PICTURE ButtonExpandedDown;
    SFT_PICTURE ButtonCollapsedDown;
    SFT_PICTURE ButtonExpandedHot;
    SFT_PICTURE ButtonCollapsedHot;

    /* read/only fields */
    int errorValue; // last GetControlInfo error value

} SFTTREE_CONTROL, * LPSFTTREE_CONTROL;

typedef const SFTTREE_CONTROL * LPCSFTTREE_CONTROL;

Members

cbSize

This field must be set to the SFTTREE_CONTROL structure size before calling GetControlInfo and SetControlInfo otherwise the call will fail.

fGridHorizontalFull

Defines whether horizontal grid lines extend into the empty area next to the last column. An empty area is only available if the last column is not an open-ended column. Set to TRUE so grid lines extend into the empty area next to the last column, otherwise FALSE. This value can be modified using SetControlInfo.

fSelectEnabledItemsOnly

Defines whether only enabled items (see ItemStatus) can be selected by the end-user. Set to TRUE so only enabled items can be selected by the end-user, otherwise FALSE. This value can be modified using SetControlInfo. An application can always select items, regardless of the settings of fSelectEnabledItemsOnly.

Functions that are used to return the selected item(s) (like CurSel, SelItemRange, SelCount, SelItems, SelItemsArray) may include disabled items, even if fSelectEnabledItemsOnly is used. The ItemStatus function can be used to test whether an item is enabled.

fRowColumnHeaderColorsOverrideTheme

Defines whether an application can override Windows themes and the row/column header colors are used to render the row/column header. Set to TRUE to use the defined colors (SFTTREE_COLORS, colorRowColHdrBg, colorRowColHdrDarkEdge, colorRowColHdrLightEdge) instead of Windows themes, otherwise set to FALSE. If all colors are set to their default value (SFTTREE_NOCOLOR), Windows themes are used.

fRowColumnFooterColorsOverrideTheme

Defines whether an application can override Windows themes and the row/column footer colors are used to render the row/column footer. Set to TRUE to use the defined colors (SFTTREE_COLORS, colorRowColFtrBg, colorRowColFtrDarkEdge, colorRowColFtrLightEdge) instead of Windows themes, otherwise set to FALSE. If all colors are set to their default value (SFTTREE_NOCOLOR), Windows themes are used.

iMouseOverTransitionEffect

Defines whether transition effects for expand/collapse buttons and tree lines are used when the mouse enters/leaves the tree control. Expand/collapse buttons and tree lines must be suitably defined to be visible (using SetShowButtons, SetShowButton0 and SetTreeLineStyle), otherwise this setting has no effect. A gradual, visual transition is used to show/hide the expand/collapse buttons and tree lines. GDI+ support is required for transition effects, otherwise iMouseOverTransitionEffect is ignored.

One value of the following table can be assigned to the iMouseOverTransitionEffect member.

iMouseOverTransitionEffectTransition effect
SFTTREE_TRANSITION_NONENo transition effects are used.
SFTTREE_TRANSITION_THEMEDVISTAONLY_NOFOCUSTransition effects are used on Windows Vista (and up) only, when Windows themes are used. When the tree control does not have the input focus and the mouse cursor enters the tree control area, the expand/collapse buttons and tree lines become visible. When the mouse cursor leaves the tree control area, they are hidden.
SFTTREE_TRANSITION_THEMEDVISTAONLYTransition effects are used on Windows Vista (and up) only, when Windows themes are used. When the mouse cursor enters the tree control area, the expand/collapse buttons and tree lines become visible. When the mouse cursor leaves the tree control area, they are hidden.
SFTTREE_TRANSITION_ALWAYS_NOFOCUSTransition effects are used on all operating systems. When the tree control does not have the input focus and the mouse cursor enters the tree control area, the expand/collapse buttons and tree lines become visible. When the mouse cursor leaves the tree control area, they are hidden.
SFTTREE_TRANSITION_ALWAYSTransition effects are used on all operating systems. When the mouse cursor enters the tree control area, the expand/collapse buttons and tree lines become visible. When the mouse cursor leaves the tree control area, they are hidden.

This value can be modified using SetControlInfo.

nCharSearchMaxInterval

Defines the interval in milliseconds, after which a search starts again if there is no character input. The default is 1000 (1 second). The exact search method is defined using CharSearchMode. This value can be modified using SetControlInfo.

iFlybyStyle

Defines how items are highlighted by flyby highlighting. If a selection style is used that uses a rounded outline rectangle with a gradient fill, the cell text is not underlined. Instead, a rounded outline rectangle with a gradient fill is used to highlight the item, based on the current selection style (see GetSelectionStyle).

One value of the following table can be assigned to iFlybyStyle.

iFlybyStyleEffect
SFTTREE_FLYBY_NONENo flyby highlighting.
SFTTREE_FLYBY_COL1Cell text in the first displayed column is underlined. If a selection style is used that uses a rounded outline rectangle with a gradient fill, the cell text is not underlined. Instead, a rounded outline rectangle with a gradient fill is used to highlight the item, based on the current selection style (see GetSelectionStyle).
SFTTREE_FLYBY_ALLCOLUMNSCell text in all columns is underlined. If a selection style is used that uses a rounded outline rectangle with a gradient fill, the cell text is not underlined. Instead, a rounded outline rectangle with a gradient fill is used to highlight the item, based on the current selection style (see GetSelectionStyle).

This value can be modified using SetControlInfo.

autoExpandHoverInterval

Defines the interval in milliseconds, after which a parent item is expanded when AutoExpand is used. If 0 is specified, the default is 1200 (1.2 seconds). This value can be modified using SetControlInfo.

toolTipTimeOn

Defines the interval in milliseconds, after which a ToolTip is shown. If 0 is specified, the default is 200 (0.2 seconds). This value can be modified using SetControlInfo.

toolTipTimeOff

Defines the interval in milliseconds, after which a ToolTip is hidden. If 0 is specified, the default is 100 (0.1 seconds). This value can be modified using SetControlInfo.

ButtonExpanded

Defines the image used as the expand/collapse button for all expanded parent items. User-defined expand/collapse button images are only used if the SetButtons(SFTTREE_BUTTON_USERDEF) is in effect and at least ButtonExpanded and ButtonCollapsed define valid images. Use Sft_ClearPicture to omit the user-defined button image. This value can be modified using SetControlInfo.

ButtonCollapsed

Defines the image used as the expand/collapse button for all collapsed parent items. User-defined expand/collapse button images are only used if the SetButtons(SFTTREE_BUTTON_USERDEF) is in effect and at least ButtonExpanded and ButtonCollapsed define valid images. Use Sft_ClearPicture to omit the user-defined button image. This value can be modified using SetControlInfo.

ButtonExpandedDown

Defines the image used as the expand/collapse button for expanded parent items, when the button is pressed. User-defined expand/collapse button images are only used if the SetButtons(SFTTREE_BUTTON_USERDEF) is in effect. If ButtonExpandedDown doesn't define an image, ButtonExpanded is used instead. Use Sft_ClearPicture to omit the user-defined button image. This value can be modified using SetControlInfo.

ButtonCollapsedDown

Defines the image used as the expand/collapse button for collapsed parent items, when the button is pressed. User-defined expand/collapse button images are only used if the SetButtons(SFTTREE_BUTTON_USERDEF) is in effect. If ButtonCollapsedDown doesn't define an image, ButtonCollapsed is used instead. Use Sft_ClearPicture to omit the user-defined button image. This value can be modified using SetControlInfo.

ButtonExpandedHot

Defines the image used as the expand/collapse button for expanded parent items, when the mouse cursor is on the button. User-defined expand/collapse button images are only used if the SetButtons(SFTTREE_BUTTON_USERDEF) is in effect. If ButtonExpandedHot doesn't define an image, ButtonExpanded is used instead. Use Sft_ClearPicture to omit the user-defined button image. This value can be modified using SetControlInfo.

ButtonCollapsedHot

Defines the image used as the expand/collapse button for collapsed parent items, when the mouse cursor is on the button. User-defined expand/collapse button images are only used if the SetButtons(SFTTREE_BUTTON_USERDEF) is in effect. If ButtonCollapsedHot doesn't define an image, ButtonCollapsed is used instead. Use Sft_ClearPicture to omit the user-defined button image. This value can be modified using SetControlInfo.

errorValue

Read/only. If the SetControlInfo function fails, the errorValue member contains an error code, indicating which structure member has caused the failure:

errorValueInvalid SFTTREE_CONTROL structure member
SFTTREE_ERR_iMouseOverTransitionEffectiMouseOverTransitionEffect
SFTTREE_ERR_nCharSearchMaxIntervalnCharSearchMaxInterval
SFTTREE_ERR_iFlybyStyleiFlybyStyle
SFTTREE_ERR_autoExpandHoverIntervalautoExpandHoverInterval
SFTTREE_ERR_toolTipTimeOntoolTipTimeOn
SFTTREE_ERR_toolTipTimeOfftoolTipTimeOff

Comments

The SFTTREE_CONTROL structure is used with GetControlInfo and SetControlInfo to retrieve and set tree control attributes.

Examples

C

        SftTree_SetScrollTips(g_hwndTree, TRUE);/* Show Scrolltips */
        SftTree_SetInheritBgColor(g_hwndTree, TRUE);/* Inherit background color of first cell */
        SftTree_SetReorderColumns(g_hwndTree, TRUE);/* Column reordering */
        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);

C++

    m_Tree.SetScrollTips(TRUE);          /* Show Scrolltips */
    m_Tree.SetInheritBgColor(TRUE);      /* Inherit background color of first cell */
    m_Tree.SetReorderColumns(TRUE);      /* Column reordering */
    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);

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