Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

SelectionArea

Defines the area where selection changes occur.

C

int WINAPI SftTree_GetSelectionArea(HWND hwndCtl);
void WINAPI SftTree_SetSelectionArea(HWND hwndCtl, int area);
int WINAPI SftTreeSplit_GetSelectionArea(HWND hwndCtl);
void WINAPI SftTreeSplit_SetSelectionArea(HWND hwndCtl, int area);

C++

int CSftTree::GetSelectionArea() const;
void CSftTree::SetSelectionArea(int area = SFTTREE_SELECTIONAREA_ALL);
int CSftTreeSplit::GetSelectionArea() const;
void CSftTreeSplit::SetSelectionArea(int area = SFTTREE_SELECTIONAREA_ALL);

Parameters

hwndCtl

The window handle of the tree control.

area

Defines the area where selection changes occur, when the user clicks the mouse button:

SFTTREE_SELECTIONAREA_ALLClicking anywhere on an item (all cells, tree lines, row header, etc.) will change the selection.
SFTTREE_SELECTIONAREA_ALLCELLSClicking on any cell of an item will change the selection.
SFTTREE_SELECTIONAREA_CELLClicking on the cell in the first column will change the selection.
SFTTREE_SELECTIONAREA_CELLTEXTClicking on the cell text in the first column will change the selection.
SFTTREE_SELECTIONAREA_ALLCELLS_ROWHDRClicking on the row header or any cell of an item will change the selection.
SFTTREE_SELECTIONAREA_CELL_ROWHDRClicking on the row header or the cell in the first column will change the selection.
SFTTREE_SELECTIONAREA_CELLTEXT_ROWHDRClicking on the row header or the cell text in the first column will change the selection.

Returns

GetSelectionArea returns a value defining the area where selection changes occur, when the user clicks the mouse button.

Comments

The GetSelectionArea and SetSelectionArea functions define the area where selection changes occur.

By using the SelectionArea function, the application can specify which areas of an item can cause a selection change when clicked. If the defined area is clicked, the selection changes. If an area of the item outside the defined area is clicked, only the current item (GetCaretIndex) is changed.

When using a limited area, such as SFTTREE_SELECTIONAREA_CELLTEXT, which only changes selections when the cell text is clicked, it is preferable to visually indicate this using the selection style SFTTREE_SELECTION_CELL1 (see SetSelectionStyle).

In a multiple selection tree control, the Control key (in combination with directional keys) can be used to move the caret location without moving the current selection, unless the style SFTTREE_SELECTIONAREA_ALL is used, in which case the Control key is ignored.

Examples

C

        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 */
        SftTree_SetShowHeaderButtons(g_hwndTree, TRUE);/* Show column header as buttons */

C++

    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 */
    m_Tree.SetShowHeaderButtons(TRUE);   /* Show column header as buttons */

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