The parent window of a combo box control receives event notifications from the combo box using the WM_COMMAND message. For information on the WM_COMMAND message, please see the Windows API documentation.
WM_COMMAND:
NotifyCode = HIWORD(wParam); idItem = LOWORD(wParam); hwndCtl = (HWND) lParam;
NotifyCode is one of the notification codes listed below. idItem is the control ID of the combo box control and hwndCtl is its window handle.
Keyboard input is reported to the parent window using the WM_NOTIFY message instead (see Keyboard Notifications).
Applications using MFC handle the WM_COMMAND notifications using the standard ON_CONTROL message-map macro and the WM_NOTIFY notifications using ON_NOTIFY (see "MFC and Notifications").
ON_CONTROL(SFTBOXN_SELCHANGE, IDC_COMBO, OnSelChange)
| NotifyCode | Description |
|---|---|
| SFTBOXN_COLUMNSIZE | The user resized a column using the mouse. The new column widths can be retrieved using GetColumns. The notification is sent whether the column is resized using the column header of the static portion or of the dropdown portion. |
| SFTBOXN_COLUMNSIZEENDED | The column resizing operation has ended, for example because the user released the mouse button. |
| SFTBOXN_COLUMNSIZESTARTED | The user is about to resize a column. The user has pressed the mouse button on the column resizing area of a column header. |
| SFTBOXN_DARKMODE_CHANGED | The active dark mode state changed. This notification is sent when the dark mode setting is SFTBOX_DARKMODE_AUTO (see SetDarkMode) and the Windows light/dark setting changes. The combo box control learns about the change through the WM_SETTINGCHANGE message, which the parent window must forward to the combo box control (see Dark Mode). Use IsDarkModeActive to retrieve the current state. |
| SFTBOXN_DPI_CHANGED | The DPI of the monitor displaying the combo box control changed. Use GetDPI to retrieve the new value. The application should send a WM_SETFONT message to the combo box control with a font suitable for the new DPI. If the dropdown portion is displayed, it is hidden before this notification is sent. |
| SFTBOXN_HIGHCONTRAST_CHANGED | The active high contrast state changed. This notification is sent when the high contrast setting is SFTBOX_HIGHCONTRAST_AUTO (see SetHighContrastMode) and the Windows high contrast setting changes. The combo box control learns about the change through the WM_SETTINGCHANGE message, which the parent window must forward to the combo box control (see High Contrast). Use IsHighContrastActive to retrieve the current state. |
| SFTBOXN_KILLFOCUS | The combo box control lost the input focus. The notification is not sent when the input focus moves between the portions of the same combo box. |
| SFTBOXN_MOUSEMOVE | The mouse cursor moved over the static portion, the edit control portion or the dropdown portion of the combo box control. Use the Windows API GetCursorPos to retrieve the cursor location. |
| SFTBOXN_OFFSETCHANGE | The horizontal scrolling offset has changed (see GetHorizontalOffset). While processing this notification, no combo box control and item attributes should be altered. |
| SFTBOXN_REORDERED | The user has reordered the columns by dragging a column header (see SetReorderColumns). |
| SFTBOXN_SELCHANGE | The selected item of the combo box control has changed, as a result of user input or because the application changed the selection (for example using SetCurSel). Use GetCurSel to retrieve the selected item. The notification is not sent if the selection is set to the item that is already selected. While the dropdown portion of a dropdown or dropdown list combo box is displayed, the selection follows the mouse cursor (see SFTBOX_CONTROL, fCursorSelect); these changes do not send the notification. |
| SFTBOXN_SETFOCUS | The combo box control received the input focus. Unlike SFTBOXN_KILLFOCUS, this notification can also be sent when the input focus moves from one portion of the combo box control to another, for example when the application calls the Windows API SetFocus for the combo box control while one of its portions already has the input focus. |
| SFTBOXN_SIZECHANGED | The size of the combo box control window has changed. This includes size changes made by the combo box control itself, as it adjusts its height to its contents. |
| SFTBOXN_TOPCHANGE | The first item displayed in the dropdown portion has changed (see GetTopIndex). |
These notifications are sent by dropdown and dropdown list combo boxes only. When the user displays the dropdown portion, SFTBOXN_DROPDOWN_READY is sent first, followed by SFTBOXN_DROPDOWN. When the user accepts an item, SFTBOXN_SELENDOK is sent, followed by SFTBOXN_CLOSEUP as the dropdown portion is hidden. When the dropdown portion is hidden without accepting an item, SFTBOXN_CLOSEUP is sent, followed by SFTBOXN_SELENDCANCEL. An application that displays or hides the dropdown portion using ShowDropDown receives SFTBOXN_DROPDOWN_READY, SFTBOXN_DROPDOWN and SFTBOXN_CLOSEUP, but not SFTBOXN_SELENDOK or SFTBOXN_SELENDCANCEL.
| NotifyCode | Description |
|---|---|
| SFTBOXN_DROPDOWN_READY | The dropdown portion of a dropdown or dropdown list combo box is about to be displayed. This is the first notification sent, before the dropdown portion is sized and positioned. An application can prevent the dropdown portion from being displayed by sending a WM_CANCELMODE message to the combo box control while handling this notification. The notification is not sent if the combo box contains no items, as the dropdown portion is not displayed in this case. |
| SFTBOXN_DROPDOWN | The dropdown portion of a dropdown or dropdown list combo box is being displayed. |
| SFTBOXN_CLOSEUP | The dropdown portion of a dropdown or dropdown list combo box is being hidden. |
| SFTBOXN_SELENDOK | The user accepted the item selected in the dropdown portion, for example by clicking an item. The notification is sent before the dropdown portion is hidden. An application can keep the dropdown portion displayed by sending a WM_CANCELMODE message to the combo box control while handling this notification; the item is accepted nonetheless. If the accepted item differs from the previously accepted item, a SFTBOXN_SELCHANGE notification is also sent. When the item is accepted by clicking it, SFTBOXN_SELCHANGE is sent before SFTBOXN_SELENDOK, otherwise it is sent after SFTBOXN_SELENDOK. |
| SFTBOXN_SELENDCANCEL | The dropdown portion was hidden without accepting the item selected in the dropdown portion, for example because the user clicked outside of the combo box control. If an item was accepted earlier, the selection is restored to that item, otherwise no item is selected. The notification is sent after the dropdown portion has been hidden. |
| SFTBOXN_SIZEBOX | The user has finished resizing the dropdown portion using the size box (see SetSizeBox). |
These notifications are sent by simple and dropdown combo boxes only, as a dropdown list combo box has no edit control portion.
| NotifyCode | Description |
|---|---|
| SFTBOXN_EDITCREATED | The edit control portion of a simple or dropdown combo box has been created. The edit control is created when the combo box control is created, so the first notification is sent while the combo box control is being created. The edit control may be destroyed and created again later as attributes of the combo box control change. An application that modifies the edit control (see GetHWNDEdit) should do so each time this notification is received. The font of the edit control portion is set after this notification has been sent (see SetEditCtlFont). |
| SFTBOXN_EDITCHANGE | The text in the edit control portion of a simple or dropdown combo box has changed (the equivalent of the edit control notification EN_CHANGE). The notification is sent after the display has been updated. It is not sent when the combo box control itself replaces the text because the selected item changes. |
| SFTBOXN_EDITUPDATE | The text in the edit control portion of a simple or dropdown combo box is about to be redrawn with altered text (the equivalent of the edit control notification EN_UPDATE). It is not sent when the combo box control itself replaces the text because the selected item changes. |
These notifications can be used to implement context menus. The notification code identifies the portion of the combo box control for which the context menu was requested and whether it was requested using the mouse or the keyboard. If the mouse was used, the Windows API GetCursorPos can be used to determine the cursor position.
An application that displays its own context menu for the edit control portion should send a WM_CANCELMODE message to the combo box control while handling the notification. This suppresses the default processing, the standard context menu of the edit control. The dropdown portion is not hidden because of the right mouse button click.
| NotifyCode | Description |
|---|---|
| SFTBOXN_CONTEXTMENU_DD | A context menu was requested for the dropdown portion using the mouse (right mouse button). |
| SFTBOXN_CONTEXTMENU_EDIT | A context menu was requested for the edit control portion using the mouse (right mouse button). |
| SFTBOXN_CONTEXTMENU_STATIC | A context menu was requested for the static portion using the mouse (right mouse button). |
| SFTBOXN_CONTEXTMENU_KBD_DD | A context menu was requested for the dropdown portion using the keyboard. |
| SFTBOXN_CONTEXTMENU_KBD_EDIT | A context menu was requested for the edit control portion using the keyboard. |
| SFTBOXN_CONTEXTMENU_KBD_STATIC | A context menu was requested for the static portion using the keyboard. |
Drag & drop notifications are sent if drag & drop has been enabled using SetDragType, for the edit control portion, the dropdown portion or both. While a notification is being handled, the SFTBOX_DRAGINFO structure returned by GetDragInfo describes the drag operation. It is up to the application to handle these notifications to implement a drag & drop operation and to set appropriate mouse cursors.
| NotifyCode | Description |
|---|---|
| SFTBOXN_BEGINDRAG | The user is starting to drag the selected item of the dropdown portion or the selected text of the edit control portion. The drag operation is described by the SFTBOX_DRAGINFO structure. An application can set the mouse cursor (hCursor) in response to this notification. The drag operation can be aborted by setting fAbort to TRUE, in which case no SFTBOXN_CANCELDRAG notification is sent. The drag operation can also be canceled by sending a WM_CANCELMODE message to the combo box control, which results in a SFTBOXN_CANCELDRAG notification. |
| SFTBOXN_DRAGGING | The user is moving the mouse cursor during a drag operation. The drag operation is described by the SFTBOX_DRAGINFO structure. An application can set the mouse cursor (hCursor) in response to this notification, typically to indicate whether the current location is a valid drop target. |
| SFTBOXN_ENDDRAG | The user released the mouse button, ending the drag operation. The drag operation is described by the SFTBOX_DRAGINFO structure. An application should process the drop in response to this notification. |
| SFTBOXN_CANCELDRAG | The drag operation was canceled, for example because the user pressed the ESCAPE key or the combo box control received a WM_CANCELMODE message. |
The following notifications are sent when the left mouse button is clicked or double-clicked in the dropdown portion. The same notifications are sent for the static portion in the form SFTBOXN_MAIN_NOTIFICATION(NotifyCode) (see Static Portion Notifications).
In a dropdown or dropdown list combo box, clicking the label picture, item picture, cells or row header of an item accepts the item and hides the dropdown portion when the mouse button is released. Clicking an expand/collapse button, the tree lines, a column header or the row/column header leaves the dropdown portion displayed. The dropdown portion also remains displayed if a disabled item is clicked while only enabled items can be selected, or if the application sets the fAllowNextRollup member to FALSE while handling the notification (see SFTBOX_CONTROL).
| NotifyCode | Description |
|---|---|
| SFTBOXN_LBUTTONDBLCLK_BUTTON | The left mouse button was double-clicked on the expand/collapse button of an item. Use GetExpandCollapseIndex to determine the item. Expand and Collapse can be used to expand or collapse the item. |
| SFTBOXN_LBUTTONDBLCLK_CELL | The left mouse button was double-clicked on a cell, but not on the cell picture. Use GetCaretColumn to retrieve the column. If the mouse button is double-clicked on the cell picture, SFTBOXN_LBUTTONDBLCLK_CELLBMP is sent instead. |
| SFTBOXN_LBUTTONDBLCLK_CELLBMP | The left mouse button was double-clicked on a cell picture. Use GetCaretColumn to retrieve the column. If the mouse button is double-clicked on the cell, but not on the cell picture, SFTBOXN_LBUTTONDBLCLK_CELL is sent instead. |
| SFTBOXN_LBUTTONDBLCLK_COLUMN | The left mouse button was double-clicked on a column header. Use GetHeaderButton to determine the column header. |
| SFTBOXN_LBUTTONDBLCLK_COLUMNRES | The left mouse button was double-clicked on the column resizing area at the edge of a column header. Use GetResizeColumn to determine the column. This notification is typically used to resize the column to its optimal width using MakeColumnOptimal. |
| SFTBOXN_LBUTTONDBLCLK_ITEM | The left mouse button was double-clicked on the item picture of an item. |
| SFTBOXN_LBUTTONDBLCLK_LABEL | The left mouse button was double-clicked on the label picture of an item. |
| SFTBOXN_LBUTTONDBLCLK_PLUSMIN | Reserved. |
| SFTBOXN_LBUTTONDBLCLK_ROW | The left mouse button was double-clicked on the row header of an item. |
| SFTBOXN_LBUTTONDBLCLK_ROWCOLUMN | The left mouse button was double-clicked on the row/column header. |
| SFTBOXN_LBUTTONDBLCLK_TEXT | The left mouse button was double-clicked on the cells of an item. Use GetCaretColumn to retrieve the column. SFTBOXN_LBUTTONDBLCLK_CELL and SFTBOXN_LBUTTONDBLCLK_CELLBMP can be used instead of this notification. |
| SFTBOXN_LBUTTONDBLCLK_TREE | The left mouse button was double-clicked in the area of an item where the tree lines are drawn. |
| SFTBOXN_LBUTTONDOWN_BUTTON | The left mouse button was clicked on the expand/collapse button of an item. Use GetExpandCollapseIndex to determine the item. Expand and Collapse can be used to expand or collapse the item. |
| SFTBOXN_LBUTTONDOWN_CELL | The left mouse button was clicked on a cell, but not on the cell picture. Use GetCaretColumn to retrieve the column. If the mouse button is clicked on the cell picture, SFTBOXN_LBUTTONDOWN_CELLBMP is sent instead. |
| SFTBOXN_LBUTTONDOWN_CELLBMP | The left mouse button was clicked on a cell picture. Use GetCaretColumn to retrieve the column. If the mouse button is clicked on the cell, but not on the cell picture, SFTBOXN_LBUTTONDOWN_CELL is sent instead. |
| SFTBOXN_LBUTTONDOWN_COLUMN | The left mouse button was clicked on a column header. Use GetHeaderButton to determine the column header. |
| SFTBOXN_LBUTTONDOWN_ITEM | The left mouse button was clicked on the item picture of an item. |
| SFTBOXN_LBUTTONDOWN_LABEL | The left mouse button was clicked on the label picture of an item. |
| SFTBOXN_LBUTTONDOWN_PLUSMIN | Reserved. |
| SFTBOXN_LBUTTONDOWN_ROW | The left mouse button was clicked on the row header of an item. |
| SFTBOXN_LBUTTONDOWN_ROWCOLUMN | The left mouse button was clicked on the row/column header. |
| SFTBOXN_LBUTTONDOWN_TEXT | The left mouse button was clicked on the cells of an item. Use GetCaretColumn to retrieve the column. SFTBOXN_LBUTTONDOWN_CELL and SFTBOXN_LBUTTONDOWN_CELLBMP can be used instead of this notification. |
| SFTBOXN_LBUTTONDOWN_TEXTAGAIN | The left mouse button was clicked on the cells of the item that was already selected. |
| SFTBOXN_LBUTTONDOWN_TREE | The left mouse button was clicked in the area of an item where the tree lines are drawn. |
The following notifications are sent when the middle mouse button is clicked or double-clicked in the dropdown portion. The same notifications are sent for the static portion in the form SFTBOXN_MAIN_NOTIFICATION(NotifyCode) (see Static Portion Notifications).
These notifications are not sent if the combo box control has the SFTBOXSTYLE_LEFTBUTTONONLY window style.
| NotifyCode | Description |
|---|---|
| SFTBOXN_MBUTTONDBLCLK_BUTTON | The middle mouse button was double-clicked on the expand/collapse button of an item. Use GetExpandCollapseIndex to determine the item. Expand and Collapse can be used to expand or collapse the item. |
| SFTBOXN_MBUTTONDBLCLK_CELL | The middle mouse button was double-clicked on a cell, but not on the cell picture. Use GetCaretColumn to retrieve the column. If the mouse button is double-clicked on the cell picture, SFTBOXN_MBUTTONDBLCLK_CELLBMP is sent instead. |
| SFTBOXN_MBUTTONDBLCLK_CELLBMP | The middle mouse button was double-clicked on a cell picture. Use GetCaretColumn to retrieve the column. If the mouse button is double-clicked on the cell, but not on the cell picture, SFTBOXN_MBUTTONDBLCLK_CELL is sent instead. |
| SFTBOXN_MBUTTONDBLCLK_COLUMN | The middle mouse button was double-clicked on a column header. Use GetHeaderButton to determine the column header. |
| SFTBOXN_MBUTTONDBLCLK_COLUMNRES | The middle mouse button was double-clicked on the column resizing area at the edge of a column header. Use GetResizeColumn to determine the column. This notification is typically used to resize the column to its optimal width using MakeColumnOptimal. |
| SFTBOXN_MBUTTONDBLCLK_ITEM | The middle mouse button was double-clicked on the item picture of an item. |
| SFTBOXN_MBUTTONDBLCLK_LABEL | The middle mouse button was double-clicked on the label picture of an item. |
| SFTBOXN_MBUTTONDBLCLK_PLUSMIN | Reserved. |
| SFTBOXN_MBUTTONDBLCLK_ROW | The middle mouse button was double-clicked on the row header of an item. |
| SFTBOXN_MBUTTONDBLCLK_ROWCOLUMN | The middle mouse button was double-clicked on the row/column header. |
| SFTBOXN_MBUTTONDBLCLK_TEXT | The middle mouse button was double-clicked on the cells of an item. Use GetCaretColumn to retrieve the column. SFTBOXN_MBUTTONDBLCLK_CELL and SFTBOXN_MBUTTONDBLCLK_CELLBMP can be used instead of this notification. |
| SFTBOXN_MBUTTONDBLCLK_TREE | The middle mouse button was double-clicked in the area of an item where the tree lines are drawn. |
| SFTBOXN_MBUTTONDOWN_BUTTON | The middle mouse button was clicked on the expand/collapse button of an item. Use GetExpandCollapseIndex to determine the item. Expand and Collapse can be used to expand or collapse the item. |
| SFTBOXN_MBUTTONDOWN_CELL | The middle mouse button was clicked on a cell, but not on the cell picture. Use GetCaretColumn to retrieve the column. If the mouse button is clicked on the cell picture, SFTBOXN_MBUTTONDOWN_CELLBMP is sent instead. |
| SFTBOXN_MBUTTONDOWN_CELLBMP | The middle mouse button was clicked on a cell picture. Use GetCaretColumn to retrieve the column. If the mouse button is clicked on the cell, but not on the cell picture, SFTBOXN_MBUTTONDOWN_CELL is sent instead. |
| SFTBOXN_MBUTTONDOWN_COLUMN | The middle mouse button was clicked on a column header. Use GetHeaderButton to determine the column header. |
| SFTBOXN_MBUTTONDOWN_ITEM | The middle mouse button was clicked on the item picture of an item. |
| SFTBOXN_MBUTTONDOWN_LABEL | The middle mouse button was clicked on the label picture of an item. |
| SFTBOXN_MBUTTONDOWN_PLUSMIN | Reserved. |
| SFTBOXN_MBUTTONDOWN_ROW | The middle mouse button was clicked on the row header of an item. |
| SFTBOXN_MBUTTONDOWN_ROWCOLUMN | The middle mouse button was clicked on the row/column header. |
| SFTBOXN_MBUTTONDOWN_TEXT | The middle mouse button was clicked on the cells of an item. Use GetCaretColumn to retrieve the column. SFTBOXN_MBUTTONDOWN_CELL and SFTBOXN_MBUTTONDOWN_CELLBMP can be used instead of this notification. |
| SFTBOXN_MBUTTONDOWN_TEXTAGAIN | The middle mouse button was clicked on the cells of the item that was already selected. |
| SFTBOXN_MBUTTONDOWN_TREE | The middle mouse button was clicked in the area of an item where the tree lines are drawn. |
The following notifications are sent when the right mouse button is clicked or double-clicked in the dropdown portion. The same notifications are sent for the static portion in the form SFTBOXN_MAIN_NOTIFICATION(NotifyCode) (see Static Portion Notifications).
These notifications are not sent if the combo box control has the SFTBOXSTYLE_LEFTBUTTONONLY window style.
| NotifyCode | Description |
|---|---|
| SFTBOXN_RBUTTONDBLCLK_BUTTON | The right mouse button was double-clicked on the expand/collapse button of an item. Use GetExpandCollapseIndex to determine the item. Expand and Collapse can be used to expand or collapse the item. |
| SFTBOXN_RBUTTONDBLCLK_CELL | The right mouse button was double-clicked on a cell, but not on the cell picture. Use GetCaretColumn to retrieve the column. If the mouse button is double-clicked on the cell picture, SFTBOXN_RBUTTONDBLCLK_CELLBMP is sent instead. |
| SFTBOXN_RBUTTONDBLCLK_CELLBMP | The right mouse button was double-clicked on a cell picture. Use GetCaretColumn to retrieve the column. If the mouse button is double-clicked on the cell, but not on the cell picture, SFTBOXN_RBUTTONDBLCLK_CELL is sent instead. |
| SFTBOXN_RBUTTONDBLCLK_COLUMN | The right mouse button was double-clicked on a column header. Use GetHeaderButton to determine the column header. |
| SFTBOXN_RBUTTONDBLCLK_COLUMNRES | The right mouse button was double-clicked on the column resizing area at the edge of a column header. Use GetResizeColumn to determine the column. This notification is typically used to resize the column to its optimal width using MakeColumnOptimal. |
| SFTBOXN_RBUTTONDBLCLK_ITEM | The right mouse button was double-clicked on the item picture of an item. |
| SFTBOXN_RBUTTONDBLCLK_LABEL | The right mouse button was double-clicked on the label picture of an item. |
| SFTBOXN_RBUTTONDBLCLK_PLUSMIN | Reserved. |
| SFTBOXN_RBUTTONDBLCLK_ROW | The right mouse button was double-clicked on the row header of an item. |
| SFTBOXN_RBUTTONDBLCLK_ROWCOLUMN | The right mouse button was double-clicked on the row/column header. |
| SFTBOXN_RBUTTONDBLCLK_TEXT | The right mouse button was double-clicked on the cells of an item. Use GetCaretColumn to retrieve the column. SFTBOXN_RBUTTONDBLCLK_CELL and SFTBOXN_RBUTTONDBLCLK_CELLBMP can be used instead of this notification. |
| SFTBOXN_RBUTTONDBLCLK_TREE | The right mouse button was double-clicked in the area of an item where the tree lines are drawn. |
| SFTBOXN_RBUTTONDOWN_BUTTON | The right mouse button was clicked on the expand/collapse button of an item. Use GetExpandCollapseIndex to determine the item. Expand and Collapse can be used to expand or collapse the item. |
| SFTBOXN_RBUTTONDOWN_CELL | The right mouse button was clicked on a cell, but not on the cell picture. Use GetCaretColumn to retrieve the column. If the mouse button is clicked on the cell picture, SFTBOXN_RBUTTONDOWN_CELLBMP is sent instead. |
| SFTBOXN_RBUTTONDOWN_CELLBMP | The right mouse button was clicked on a cell picture. Use GetCaretColumn to retrieve the column. If the mouse button is clicked on the cell, but not on the cell picture, SFTBOXN_RBUTTONDOWN_CELL is sent instead. |
| SFTBOXN_RBUTTONDOWN_COLUMN | The right mouse button was clicked on a column header. Use GetHeaderButton to determine the column header. |
| SFTBOXN_RBUTTONDOWN_ITEM | The right mouse button was clicked on the item picture of an item. |
| SFTBOXN_RBUTTONDOWN_LABEL | The right mouse button was clicked on the label picture of an item. |
| SFTBOXN_RBUTTONDOWN_PLUSMIN | Reserved. |
| SFTBOXN_RBUTTONDOWN_ROW | The right mouse button was clicked on the row header of an item. |
| SFTBOXN_RBUTTONDOWN_ROWCOLUMN | The right mouse button was clicked on the row/column header. |
| SFTBOXN_RBUTTONDOWN_TEXT | The right mouse button was clicked on the cells of an item. Use GetCaretColumn to retrieve the column. SFTBOXN_RBUTTONDOWN_CELL and SFTBOXN_RBUTTONDOWN_CELLBMP can be used instead of this notification. |
| SFTBOXN_RBUTTONDOWN_TEXTAGAIN | The right mouse button was clicked on the cells of the item that was already selected. |
| SFTBOXN_RBUTTONDOWN_TREE | The right mouse button was clicked in the area of an item where the tree lines are drawn. |
The static portion of a combo box control can display the same components as the dropdown portion, such as column headers (see SetShowHeaderMain), a row header, pictures and cells. Mouse button notifications are sent for both portions. To allow an application to tell them apart, a mouse button notification originating in the static portion uses the notification code of the dropdown portion with SFTBOXN_MAIN_NOTIFICATION_MASK (0x1000) added. The SFTBOXN_MAIN_NOTIFICATION macro is used to build these notification codes:
#define SFTBOXN_MAIN_NOTIFICATION_MASK 0x1000 #define SFTBOXN_MAIN_NOTIFICATION(x) ((x)+SFTBOXN_MAIN_NOTIFICATION_MASK)
For example, a click with the left mouse button on a column header of the dropdown portion sends SFTBOXN_LBUTTONDOWN_COLUMN, a click on a column header of the static portion sends SFTBOXN_MAIN_NOTIFICATION(SFTBOXN_LBUTTONDOWN_COLUMN):
case WM_COMMAND:
switch (HIWORD(wParam)) {
case SFTBOXN_LBUTTONDOWN_COLUMN:
// column header of the dropdown portion clicked
break;
case SFTBOXN_MAIN_NOTIFICATION(SFTBOXN_LBUTTONDOWN_COLUMN):
// column header of the static portion clicked
break;
}
break;This form applies to all left, middle and right mouse button notifications listed above. All other notifications use the same notification code, no matter which portion of the combo box control caused them.
While a mouse button notification is being handled, GetCaretColumn and GetResizeColumn return the column information of the portion that sent the notification. GetExpandCollapseIndex returns information about the dropdown portion only.
Keyboard input is reported to the parent window of the combo box control using the WM_NOTIFY message, before the combo box control processes the input. The lParam parameter of the WM_NOTIFY message addresses one of the following structures, which all start with a NMHDR structure. The NMHDR member code identifies the notification.
| code | Structure | Description |
|---|---|---|
| NM_SFTBOX_KEYDOWN_CODE | NM_SFTBOX_KEYDOWN | A key was pressed (WM_KEYDOWN) while the combo box control had the input focus. |
| NM_SFTBOX_KEYUP_CODE | NM_SFTBOX_KEYUP | A key was released (WM_KEYUP) while the combo box control had the input focus. |
| NM_SFTBOX_CHAR_CODE | NM_SFTBOX_CHAR | A character was entered (WM_CHAR) while the combo box control had the input focus. |
An application can set the structure member fHandled to TRUE to indicate that it has processed the keyboard input. The combo box control then ignores the input.
MFC applications handle these notifications using the ON_NOTIFY message-map macro.
See Also C/C++ API | Categories | Notifications