As discussed in the previous topic, Which Command-Target Class Gets the Handler?, Scribble’s Clear All command is bound to the document class.
To create the starter handler for Scribble’s Clear All command
Recall the decision to handle the command from the document rather than the view. That’s why the handler for Clear All will be placed in CScribbleDoc
.
The New Windows Message Handler dialog box appears.
You can see both COMMAND and UPDATE_COMMAND_UI in the New Windows messages to handle list box. These are the two events for which the framework provides ClassWizard support in creating your command handler code. That’s why, for commands, these are always the choices you see in this list box. In other cases, you might see other things listed — a list of Windows messages, for example, when the selected item is the name of a window or view class.
Later in the lesson, in Update Scribble’s Clear All Menu Item, you’ll see how UPDATE_COMMAND_UI is used for this menu command.
OnEditClearAll
.The following figure shows the selections from steps 3 through 7.
Clear All in WizardBar
ClassWizard creates the starter handler function at the end of ScribbleDoc.cpp and highlights the //TODO comments where you will add the code, which is described in the next procedure, To complete the OnEditClearAll handler function.