Windows Predefined Controls – Part 23
Volume – Windows User Interface
This is part 23 of my series, Windows Predefined Controls. In order to understand this tutorial, you must have read all the previous tutorials of the series. In this part of the series, we look at Combo Box Notifications.
Note: If you cannot see the code or if you think anything is missing (broken link, image absent), just contact me at email@example.com. That is, contact me for the slightest problem you have about what you are reading.
When a user causes an event on a combo box, a message is sent to the window class procedure of the parent window of the combo box. Such a message is called a notification. Each of these messages is actually an identifier for a constant. The notification is sent to the procedure in the form of a WM_COMMAND message. To know more about the WM_COMMAND message, read the tutorial in this blog titled, Control Messages. I now give you the notification code and their meanings.
Notification Code: Meaning
CBN_CLOSEUP: This code is sent when the list box of a combo box has been closed.
CBN_DBLCLK: This code is sent when the user double-clicks a string in the list box of a combo box.
CBN_DROPDOWN: This code is sent when the list box of a combo box is about to be made visible.
CBN_EDITCHANGE: This code is sent after the user has taken an action that may have altered the text in the edit control portion of a combo box. Unlike the CBN_EDITUPDATE notification code (see below), this notification code is sent after the system updates the screen.
CBN_EDITUPDATE: This code is sent when the edit control portion of a combo box is about to display altered text. This notification code is sent after the control has formatted the text, but before it displays the text.
CBN_ERRSPACE: This code is sent when a combo box cannot allocate enough memory to meet a specific request.
CBN_KILLFOCUS: This code is sent when a combo box loses the keyboard focus.
CBN_SELCHANGE: This code is sent when the user changes the current selection in the list box of a combo box. The user can change the selection by clicking in the list box or by using the arrow keys. The parent window of the combo box receives this notification in the form of a WM_COMMAND message with CBN_SELCHANGE in the high-order word of the wParam parameter.
CBN_SELENDCANCEL: This code is sent when the user selects an item, but then selects another control or closes the dialog box. It indicates the user’s initial selection is to be ignored.
CBN_SELENDOK: This code is sent when the user selects a list item, or selects an item and then closes the list. It indicates that the user’s selection is to be processed.
CBN_SETFOCUS: This code is sent when a combo box receives the keyboard focus.
That is it for this part of the series. We stop here and continue in the next part.
To arrive at any of the parts of this series, just type the corresponding title below in the Search Box of this page and click Search (use menu if available):
List Box Functions
Windows Combo Box
Combo Box Styles
Combo Box Notifications
Combo Box Messages
Creating Combo Boxes
Combo Box functions