The IDOK, IDCANCEL, and UNUSED Symbols

Because most dialog boxes have OK and Cancel buttons, the system provides defined symbols for these elements.

You use the defined symbol IDOK for an OK button in your dialog. When the user presses ENTER, the system sends your dialog procedure a message as if the OK button had been pressed. IDOK has an ID value of 1.

You use IDCANCEL for a Cancel button in your dialog. When the user presses ESC, it's as if the Cancel button had been pressed. IDCANCEL has an ID value of 2.

Some controls don't need a unique identifier. For example, you won't usually need to access a group box frame, which simply frames other controls. You can assign all such controls the symbol (Unused), which has an ID value of –1.

To display and edit the current symbols, click Symbols from the Edit menu. The Symbols dialog box displays a list box of symbols and corresponding IDs. You can add, change, and delete symbols in the Symbols dialog box.

When you remove a control from a dialog, the symbol and ID for that control remain defined but not in use. You can display unused symbols by checking the Show Unused Symbols Only check box in the Symbols dialog box. You can then delete these unused symbols if you like.

The Text field on the properties bar contains the button's default text, Push.

    To assign other text to the button
  1. Type the text for the push button in the Text edit field.
  2. Press ENTER.

For example, you might assign the symbol IDOK to your first push button and give it the text OK, and then press ENTER.

To make the width of a selected control better fit its text, click Size to Text from the Edit menu. However, you cannot size a push button smaller than a default-sized push button. A push button always automatically maintains a margin around its text. The following controls can be sized to their text:

    To size a control to its text
  1. Select the control.
  2. Click Size to Text from the Edit menu, or press f7.

You can size a single control to fit its text, or you can select a group of controls and size them all at once. If a group of controls is selected, only those controls that support sizing to fit their text will be changed.