Visual C++ and MFC Fundamentals Chapter 20: List-Based Controls
?? If the user finds the desired item in the list, he or she must let the combo box
know. This is done by highlighiting it. To do this, the user can either click (with
the mouse) or press the arrow keys (on the keyboard) to indicate his or her
choice. When this highlighting occurs, the combo box sends the
ON_CBN_SELCHANGE message, notifying the application that the combo
box’ selection may be changed soon
?? Once the user has found the desired item and has possibly highlighted it, if using
the mouse, he or she can click to select it. If using the keyboard, after locating
the item, the user can press Enter. Clicking the desired item or pressing Enter on
the highlighted string means that the user has made a definite selection. This
causes the control to send an ON_CBN_SELENDOK message, notifying the
application that the user has made his or her decision.
?? If the user did not find the desired item, he or she may want to dismiss the
combo box without making a selection. There are three main ways the user can
invalidate a selection. If the user clicks another control or another application, if
the list was displaying, it would retract and not selection would be made, event
if the user had already highlighted an item. If the user clicks either the edit box
part of the combo box for a Drop List type or the down pointing button, the
selection is dismissed and if the list of a drop type was displaying, it would
retract. If the user presses Esc, the selection would be dismissed.
Any of these actions causes the selection to be dismissed or the user to cancel
the selection action. This causes the combo box to send an
ON_CBN_SELENDCANCEL message.
Once the user has clicked an item or pressed Enter to validate a selection, if the combo
box was created not as Simple, the list part of the controls retracts to hide itself. At this
time, the combo box sends an ON_CBN_CLOSEUP message.
If the user finishes using the combo box and moves to another control, the combo box
sends an ON_CBN_KILLFOCUS message, notifying the application that it (the combo
box) has lost focus.
20.3 Image Lists...................................................................................................
20.3.1..Introduction..........................................................................................
An image list is an array of pictures of the same size. The pictures are created as a single
icon or bitmap and each icon or bitmap can be located using its index. The array is zero-
based, meansing that the first picture has an index of 0. The second has an index of 1, etc.
An image list is not a traditional control. It does not display to the user who in fact is
never aware of it. It is used to complement a control that needs a series of pictures for its
own display.
Practical Learning: Introducing Image Lists
- Start a new MFC Application and name it AirCraft1
- Create it as a Single Document based on CView, without the initial toolbar, and
change the Main Frame Caption to Air Craft Review