Defines the column used for searching and for the text shown in the edit control portion.
C
int WINAPI SftBox_GetEditSearchColumn(HWND hwndCtl); void WINAPI SftBox_SetEditSearchColumn(HWND hwndCtl, int col);
C++
int CSftBox::GetEditSearchColumn() const; void CSftBox::SetEditSearchColumn(int col);
hwndCtl
The window handle of the combo box control.
col
The zero-based column number. If -1 is specified, the first displayed column is used. Values less than -1 are treated as -1.
GetEditSearchColumn returns the zero-based column number used for searching and for the text shown in the edit control portion. -1 is returned if the first displayed column is used.
The GetEditSearchColumn and SetEditSearchColumn functions define the column used for searching and for the text shown in the edit control portion.
By default, column 0 is used.
As the user types, the combo box searches for a matching item using the method defined with SetEditSearchMode. The cell text of the column defined using SetEditSearchColumn is compared to the text typed by the user.
In a simple or dropdown combo box, the same column also provides the text shown in the edit control portion when an item is selected.
The column number is a real column number, which does not change when columns are reordered (see GetRealColumn). By specifying -1, the search always uses the column that is currently displayed first.
If the column number specified is greater than the number of columns available, the last column is used.
SftBox_SetGridStyle(hwndBox, SFTBOX_GRID_VERT);
SftBox_SetDroppedHeight(hwndBox, 10); // Show up to 10 items
SftBox_SetDropDownOptimalWidth(hwndBox, TRUE);// The dropdown is as wide as its columns
SftBox_SetDisableNoScroll(hwndBox, TRUE); // Scroll bars always shown, needed for the sizing box
SftBox_SetShowResizer(hwndBox, TRUE); // The user can resize the dropdown
SftBox_SetDarkMode(hwndBox, SFTBOX_DARKMODE_AUTO);
// The edit portion shows and searches this column.
SftBox_SetEditSearchColumn(hwndBox, editColumn);
// Typing completes the text with the first matching item.
SftBox_SetEditSearchMode(hwndBox, SFTBOX_SEARCH_AUTOCOMPLETE);
if (editColumn == COL_ABBR)
SftBox_LimitText(hwndBox, 2);
for (i = 0 ; i < STATE_COUNT ; ++i) {
LONG index = SftBox_AddString(hwndBox, m_aStates[i].lpszName);
box.SetGridStyle(SFTBOX_GRID_VERT);
box.SetDroppedHeight(10); // Show up to 10 items
box.SetDropDownOptimalWidth(TRUE); // The dropdown is as wide as its columns
box.SetDisableNoScroll(TRUE); // Scroll bars always shown, needed for the sizing box
box.SetShowResizer(TRUE); // The user can resize the dropdown
box.SetDarkMode(SFTBOX_DARKMODE_AUTO);
// The edit portion shows and searches this column.
box.SetEditSearchColumn(editColumn);
// Typing completes the text with the first matching item.
box.SetEditSearchMode(SFTBOX_SEARCH_AUTOCOMPLETE);
if (editColumn == COL_ABBR)
box.LimitText(2);
for (int i = 0 ; i < STATE_COUNT ; ++i) {
LONG index = box.AddString(m_aStates[i].lpszName);See Also C/C++ API | Categories | Notifications