Combo Box Notifications
Windows Predefined Controls – Part 23
Volume - Windows User Interface
Forward: In this part of the series, we look at Combo Box Notifications.
By: Chrysanthus Date Published: 29 Aug 2012
Introduction
Note: If you cannot see the code or if you think anything is missing (broken link, image absent), just contact me at forchatrans@yahoo.com. That is, contact me for the slightest problem you have about what you are reading.
Notifications
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.
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.
Chrys