
Output of simple_option.c
16.3 Designing Menu Systems
The advantages of the simple menu creation routines are clear. It is easy to create menus with them, the code is
extremely readable, and the job gets done without much room for error. Once the code is written, it is easy to modify
the callback function, labels, mnemonics, and accelerators used by a menu.
There are also some disadvantages to using the simple menu creation functions. One problem is that they require a
great deal of bulk to create a single menu. If an application needs to create a large number of menus, it has to use a lot
of redundant code because the simple creation routines make it difficult to build a looping construct or a function to
automate the process. Since the creation routines name the widgets using non−unique names, it is difficult to specify
labels, mnemonics, and accelerators in a resource file. If these values are set using a creation routine, this point is
irrelevant because the routines hard−code the values. The simple creation routines also make it impossible to specify
different callback functions for menu items.
To get around the shortcomings of the simple creation routines, we are going to build a new system that is just as
simple to use, but more dynamic and easy to modify. Before we can build our new system, we need to examine the
advanced Motif menu creation routines and discuss the overall design of ...