Defines the column number of the currently pressed column header button.
C
int WINAPI SftBox_GetHeaderButton(HWND hwndCtl); BOOL WINAPI SftBox_SetHeaderButton(HWND hwndCtl, int col);
C++
int CSftBox::GetHeaderButton() const; BOOL CSftBox::SetHeaderButton(int col);
hwndCtl
The window handle of the combo box control.
col
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.
GetHeaderButton returns the zero-based column number of the column header button currently pressed down or -1 if no button is pressed down.
SetHeaderButton returns TRUE if the function was successful, otherwise FALSE is returned (col is neither -1 nor a valid column number).
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 button will remain in its down state until another button is pressed or until SetHeaderButton sets a new (or no) button.
SetHeaderButton sets the column header button in the static portion and the dropdown portion. GetHeaderButton returns the pressed column header button of the dropdown portion. If no button is pressed there, the pressed column header button of the static portion is returned.
If the column title style is defined using SFTBOX_HEADER_UP, the header button automatically returns to its "up" position when clicked (see SFTBOX_COLUMN, styleTitle).
{
return lstrcmpi(lpszString2, lpszString1);
}
static void SortByColumn(HWND hwndBox)
{
// The sort column and direction of each control are kept in its user data,
// matching the sort indicator the control shows in the column title.
int column = SftBox_GetHeaderButton(hwndBox);
SFTBOX_DWORD_PTR state = SftBox_GetUserData(hwndBox);
int lastColumn = (int) LOWORD(state) - 1;
BOOL fDescending = HIWORD(state) != 0;
if (column < 0)
return;
fDescending = (column == lastColumn) ? !fDescending : FALSE;
m_City.AddString(_T("Miami"));
m_City.AddString(_T("Tampa"));
}
void CMainDlg::SortByColumn(CSftBox& box)
{
// The sort column and direction of each control are kept in its user data,
// matching the sort indicator the control shows in the column title.
int column = box.GetHeaderButton();
SFTBOX_DWORD_PTR state = box.GetUserData();
int lastColumn = (int) LOWORD(state) - 1;
BOOL fDescending = HIWORD(state) != 0;
if (column < 0)
return;
fDescending = (column == lastColumn) ? !fDescending : FALSE;See Also C/C++ API | Categories | Notifications