Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

SelectionStyle

Defines the display style of selected items.

C

int WINAPI SftTree_GetSelectionStyle(HWND hwndCtl);
void WINAPI SftTree_SetSelectionStyle(HWND hwndCtl, int style);
int WINAPI SftTreeSplit_GetSelectionStyle(HWND hwndCtl);
void WINAPI SftTreeSplit_SetSelectionStyle(HWND hwndCtl, int style);

C++

int CSftTree::GetSelectionStyle() const;
void CSftTree::SetSelectionStyle(int style = SFTTREE_SELECTION_ALL);
int CSftTreeSplit::GetSelectionStyle() const;
void CSftTreeSplit::SetSelectionStyle(int style = SFTTREE_SELECTION_ALL);

Parameters

hwndCtl

The window handle of the tree control.

style

Defines the display style used for selected items. Style can be one of the following values:

SFTTREE_SELECTION_ALLHighlights the entire item, including all cells, the label picture and item picture. When using the 3D display mode (enabled using SetShow3D), SFTTREE_SELECTION_ALL is equivalent to SFTTREE_SELECTION_CELLS.
SFTTREE_SELECTION_CELLSHighlights cells only.
SFTTREE_SELECTION_CELL1Highlights the text in the first cell only.
SFTTREE_SELECTION_CELLCURRENTHighlights the entire current cell only. The current cell is always the cell in the first displayed column of the selected item(s).
SFTTREE_SELECTION_CELL1FULLHighlights the text in the first cell only. Identical to SFTTREE_SELECTION_CELL1, but the text background color of the selected item extends to the top and bottom of the cell.
The value of an entry in the above table can be combined with the following value and passed as style parameter:
SFTTREE_SELECTION_OUTLINEThe selected display style from the above table is rendered using a rounded outline rectangle with a gradient fill. The outline colors and gradient fill are defined using the members of the SFTTREE_COLORS structure. GDI+ support is required, otherwise SFTTREE_SELECTION_OUTLINE is ignored.

Returns

GetSelectionStyle returns a value indicating the current display mode of selected items.

Comments

The GetSelectionStyle and SetSelectionStyle functions define the display style of selected items.

SelectionStyle affects the visual representation of the selected items only. SftTree/DLL supports item selection only. Cell selection as typically found in a grid control is not supported. It is possible to emulate cell selection using cell foreground and background colors (and using ShowFocus).

Examples

C

        SftTree_SetShowButton0(g_hwndTree, TRUE);/* Show expand/collapse buttons (level 0) */
        if (SftTree_GetGDIPlusAvailable(g_hwndTree))
            SftTree_SetButtons(g_hwndTree, SFTTREE_BUTTON_USERDEF);/* User-defined buttons */
        else
            SftTree_SetButtons(g_hwndTree, SFTTREE_BUTTON_AUTOMATIC3);/* Automatic button style 3 */
        SftTree_SetShowGrid(g_hwndTree, TRUE);/* Show grid */
        SftTree_SetGridStyle(g_hwndTree, SFTTREE_GRID_BOTH_DOT);/* Dotted grid lines */
        SftTree_SetShowTruncated(g_hwndTree, TRUE);/* Show ... if truncated */
        SftTree_SetSelectionStyle(g_hwndTree, SFTTREE_SELECTION_ALL | SFTTREE_SELECTION_OUTLINE);/* Select entire item using outline */
        SftTree_SetSelectionArea(g_hwndTree, SFTTREE_SELECTIONAREA_ALLCELLS);/* Selection changes by clicking on an item's cells */
        SftTree_SetFlyby(g_hwndTree, TRUE);  /* Flyby highlighting */
        SftTree_SetUpdateCaretExpandCollapse(g_hwndTree, FALSE);/* don't update caret location when expand/collapse button clicked */
        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 */

C++

    m_Tree.SetShowButton0(TRUE);         /* Show expand/collapse buttons (level 0) */
    if (m_Tree.GetGDIPlusAvailable())
        m_Tree.SetButtons(SFTTREE_BUTTON_USERDEF);/* User-defined buttons */
    else
        m_Tree.SetButtons(SFTTREE_BUTTON_AUTOMATIC3);/* Automatic button style 3 */
    m_Tree.SetShowGrid(TRUE);            /* Show grid */
    m_Tree.SetGridStyle(SFTTREE_GRID_BOTH_DOT);/* Dotted grid lines */
    m_Tree.SetShowTruncated(TRUE);       /* Show ... if truncated */
    m_Tree.SetSelectionStyle(SFTTREE_SELECTION_ALL | SFTTREE_SELECTION_OUTLINE);/* Select entire item using outline */
    m_Tree.SetSelectionArea(SFTTREE_SELECTIONAREA_ALLCELLS);/* Selection changes by clicking on an item's cells */
    m_Tree.SetFlyby(TRUE);               /* Flyby highlighting */
    m_Tree.SetUpdateCaretExpandCollapse(FALSE);/* don't update caret location when expand/collapse button clicked */
    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 */

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