Another way that you can define a set of menus is by defining a command table. A command table lets you create the complete set of commands for an application in a more compact and reusable way than the standard menus you have seen so far. As well as making the definition of each command in a menu shorter and easier to code, it lets you handle effects such as the disabling of menu commands more elegantly, by removing the need to use gadget-enabled. You can include a command table in the definition of a frame in the same way that you can include a tool bar, or a status bar, and because of this, and the fact that you can include command tables within other command tables, it is easy to reuse the same command table across different frames in your application.
Command tables are best used in the following situations:
In other cases, you should define your menu hierarchy by defining panes that combine specific gadgets, as demonstrated in Chapter 4, "Adding Menus To The Application". Using a combination of command tables and standard menu definitions in a GUI design is not recommended.
The task list manager application does not use check or radio buttons in any of its menu commands, and the menu bar is not context sensitive. This means that, if you wish, you can define the commands in the task list manager using command tables, rather than standard menus.
This chapter provides an introduction to command tables by showing you how to re-implement the menu system of the task list manager as a set of command tables. It does not provide a complete copy of all the source code necessary to implement the task list manager. For a complete copy of the code, please refer to Appendix A, "Source Code For The Task List Manager". To load the code into the environment, choose Tools > Open Example Project from any window in the environment, and load the Task List 2 project from the Documentation category of the Open Example Project dialog. Please note that this project, like the Task List 1 project, is called task-list within the source code, and you should not load them both into the environment at the same time.