Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

HeaderButton

Defines the column number of the currently pressed column header button.

C

int WINAPI SftTree_GetHeaderButton(HWND hwndCtl);
BOOL WINAPI SftTree_SetHeaderButton(HWND hwndCtl, int realCol);
int WINAPI SftTreeSplit_GetHeaderButton(HWND hwndCtl);
BOOL WINAPI SftTreeSplit_SetHeaderButton(HWND hwndCtl, int realCol);

C++

int CSftTree::GetHeaderButton() const;
void CSftTree::SetHeaderButton(int realCol);
int CSftTreeSplit::GetHeaderButton() const;
void CSftTreeSplit::SetHeaderButton(int realCol);

Parameters

hwndCtl

The window handle of the tree control.

realCol

The zero-based column number specifying which header button to set to the "down" state. This value can be -1, which causes all header buttons to go to their "up" state.

Returns

GetHeaderButton returns the zero-based column number of the column header button currently pressed down or -1 if no button is pressed down.

Comments

The GetHeaderButton and SetHeaderButton functions define the column number of the currently pressed column header button.

Only one column header button can be down at any one time. A column header button can be pressed by the user or under program control using SetHeaderButton. Once pressed, the new button will remain in its down state until another button is pressed or until SetHeaderButton sets a new (or no) button.

If the column title style is defined using SFTTREE_HEADER_UP, the header button automatically returns to its "up" position when clicked (see SFTTREE_COLUMN_EX).

Examples

C

                    break;
                case SFTTREEN_LBUTTONDOWN_CELLBMP:
                case SFTTREEN_LBUTTONDBLCLK_CELLBMP:
                    ToggleCellPicture(g_hwndTree, SftTree_GetCaretIndex(g_hwndTree));
                    break;

                case SFTTREEN_LBUTTONDOWN_COLUMN_HEADER:
                case SFTTREEN_LBUTTONDBLCLK_COLUMN_HEADER:
                    if (SftTree_GetHeaderButton(g_hwndTree) == 0) // sort column 0
                        SetSortDirection(g_hwndTree, !g_fAscending);
                    break;
                }
                break;
                

            case IDM_EXIT:                  // Menu command, Exit

C++

void CSampleView::OnToggleCellPicture()
{
    ToggleCellPicture(m_Tree.GetCaretIndex());
}

void CSampleView::OnSetSortDirection()
{
    if (m_Tree.GetHeaderButton() == 0) // sort column 0
        SetSortDirection(!m_fAscending);
}

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