Visual C++ and MFC Fundamentals Chapter 20: List-Based Controls
- Right-click the new menu item and click Add Event Handler...
- Accept the Message Type as COMMAND. In the Class List, click CAirCraft1View.
Accept the name of the function. Then click Add And Edit and implement the event
as follows:
void CAirCraft1View::OnViewAh64()
{
// TODO: Add your command handler code here
nImage = 0;
Invalidate();
}
- Again, under the View menu, create a new menu item with a caption as
A&H64 Side and press Enter - Add a COMMAND Event Handler for the new menu item. Associate it with the
view class and implement it as follows:
void CAirCraft1View::OnViewAh64side()
{
// TODO: Add your command handler code here
nImage = 1;
Invalidate();
}
- Again, under the View menu, create a new menu item with a caption as A&kiowa
and press Enter - Add a COMMAND Event Handler for the new menu item. Associate it with the
view class and implement it as follows:
void CAirCraft1View::OnViewAkiowa()
{
// TODO: Add your command handler code here
nImage = 2;
Invalidate();
}
- Again, under the View menu, create a new menu item with a caption as
&Commanche and press Enter - Add a COMMAND Event Handler for the new menu item. Associate it with the
view class and implement it as follows:
void CAirCraft1View::OnViewCommanche()
{
// TODO: Add your command handler code here
nImage = 3;
Invalidate();
}
- Test the application