Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

NoFocusStyle

Defines the display style of selected items when the tree control does not have the input focus.

C

int WINAPI SftTree_GetNoFocusStyle(HWND hwndCtl);
void WINAPI SftTree_SetNoFocusStyle(HWND hwndCtl, int NoFocusStyle);
int WINAPI SftTreeSplit_GetNoFocusStyle(HWND hwndCtl);
void WINAPI SftTreeSplit_SetNoFocusStyle(HWND hwndCtl, int NoFocusStyle);

C++

int CSftTree::GetNoFocusStyle() const;
void CSftTree::SetNoFocusStyle(int type);
int CSftTreeSplit::GetNoFocusStyle() const;
void CSftTreeSplit::SetNoFocusStyle(int type);

Parameters

hwndCtl

The window handle of the tree control.

NoFocusStyle

A value describing the display style of selected items when the tree control does not have the input focus:

SFTTREE_NOFOCUS_KEEPSELThe selected items are drawn the same way as for a tree control that has the input focus. If a rounded selection outline rectangle is used (see SFTTREE_SELECTION_OUTLINE), the colors used are defined using the nofocusOutlineBorder, nofocusInnerBorder, nofocusInnerFill1 and nofocusInnerFill2 members of the SFTTREE_COLORS structure. Otherwise, the colorSelBgNoFocus and colorSelFgNoFocus members are used. If these colors are identical to the colors selectionOutlineBorder, selectionInnerBorder, selectionInnerFill1, selectionInnerFill2 or colorSelBg and colorSelBgNoFocus, the user cannot distinguish between selected items in an active tree control and an inactive control.
SFTTREE_NOFOCUS_FRAMEThe selected items are drawn as items that are not selected, but are framed by a rectangle drawn using the color specified by the colorSelBg member of the SFTTREE_COLORS structure. If a rounded selection outline rectangle is used (see SFTTREE_SELECTION_OUTLINE), SFTTREE_NOFOCUS_FRAME is identical to SFTTREE_NOFOCUS_KEEPSEL.
SFTTREE_NOFOCUS_NOTHINGThe selected items are drawn as items that are not selected. The user cannot distinguish between selected items and items that are not selected in an inactive tree control.

Returns

GetNoFocusStyle returns a value describing the display style of selected items when the tree control does not have the input focus.

Comments

The GetNoFocusStyle and SetNoFocusStyle functions define the display style of selected items when the tree control does not have the input focus.

Examples

C

    m_editIndex = index; /* save position */
    m_editCol = col;

    SftTree_SetCurSel(g_hwndTree, index); // <<<< added:  selection follows item being edited
    SftTree_SetCaretIndex(g_hwndTree, index); // <<<< added:  selection follows item being edited

    /* Change selection style to not shown anything */
    SftTree_SetNoFocusStyle(g_hwndTree, SFTTREE_NOFOCUS_NOTHING);

    /* Copy the text found in the tree control */
    SftTree_GetTextCol(g_hwndTree, m_editIndex, m_editCol, szBuffer);

    SftTree_AdjustCellEditRect(g_hwndTree, m_editIndex, m_editCol, &rect);
    EditParent = SftTree_GetCellEditWindow(g_hwndTree, m_editIndex, m_editCol);

    // based on font height, get best height for the control used for cell editing

C++

    m_editIndex = index; /* save position */
    m_editCol = col;

    m_Tree.SetCurSel(index); // <<<< added:  selection follows item being edited
    m_Tree.SetCaretIndex(index); // <<<< added:  selection follows item being edited

    /* Change selection style to not shown anything */
    m_Tree.SetNoFocusStyle(SFTTREE_NOFOCUS_NOTHING);

    /* Copy the text found in the tree control */
    CString str;
    m_Tree.GetText(m_editIndex, m_editCol, str);

    m_Tree.AdjustCellEditRect(m_editIndex, m_editCol, &rect);
    CWnd* pEditParent = m_Tree.GetCellEditWindow(m_editIndex, m_editCol);

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