|
OWLNext 7.0
Borland's Object Windows Library for the modern age
|
You can use command-item toggling to provide the users of your applications visual cues about what functions are enabled, various application states, and so on.
Anything that can be presented in a Boolean fashion, such as on and off, in and out, and so on, can be represented by command-item toggling.
Two different types of toggling are implemented in ObjectWindows, but both are implemented the same way.
There is also a third, indeterminate state, the meaning of which is up to you. It usually indicates a situation where the criteria for being enabled or disabled are mixed. For example, many word processors have control bar buttons that indicate the current text format, such as a button with a B on it to indicate bold text. This button is unchecked when the current text format is not bold and checked when the format is bold. But if a block of text contains text, some of which is bold and some not, the button is placed in its indeterminate state.
A variation of toggling button gadgets is to enable or disable an exclusive button gadget. Exclusive button gadgets work just like radio buttons. In a group of exclusive button gadgets only one button gadget can be on at a time. Enabling another button gadget in the group disables the previously enabled button gadget.
To toggle a command item,
A common use for toggling command items is to let the user of your application specify if some feature should be active. For example, suppose your application provides both a menu item and a control bar button to access the CmFileSave function. Many applications provide fly-over hints, short descriptions that appear in the status bar when the pointer moves over a menu item or button gadget. You might want to let the user turn these hints off. To provide this option to the user, you can
The code would look something like this:
The control bar is set up by the application object in its InitMainWindow function. (The code for this is not shown here.) For a working example of command item toggling, see the example EXAMPLES\OWL\OWLAPPS\MDIFILE.