Associating the Toolbar Button with a Command ID

In this task, you will associate the new Thick Line button with the command ID ID_PEN_THICK_OR_THIN, which you defined earlier for the Thick Line menu command. This step is identical to the one you performed to associate a menu item with a command ID.

Note   You don’t need to delete the command IDs for the buttons you deleted. The Visual C++ environment does that for you automatically.

To associate the button with a command ID

  1. Click Properties from the View menu to display the Toolbar Button Properties page.

    You’ll notice that Visual C++ has already assigned a command ID to the button. You will replace this ID with an existing ID — the one defined for the Thick Line menu command.

  2. From the ID drop-down list, select ID_PEN_THICK_OR_THIN.

    You can also type this directly into the ID box.

  3. Save your work.

Note   By associating the command ID with the toolbar button, the string resources become active for the button as well: when the mouse passes over the button, the prompt string displays in the status bar, and the tool tip displays by the button.

The following figure shows the modified toolbar resource as it appears in Scribble.

The Edited Toolbar Resource