next up previous contents
Next: Sample Script Up: How to use Cmenu Previous: How to use Cmenu   Contents

General operation

The typical sequence of using the Cmenu functions is;
  1. Initialise the Module and Curses by calling menu_initialise. This activates Curses and sets up module variables. Once this has been called, Curses is active; this means screen I/O should only be performed through Curses functions. If your script bombs before closing Curses down your terminal may well be scrambled - run reset to restore its sanity.
  2. Create a new menu with the menu_init function.
  3. Create one or more menu items with the menu_item function. This is the most powerful function as it allows you control over the functioning and appearance of each menu item.
  4. Display the menu by calling menu_display. This routine performs all menu navigation, field editing, help displays and other stuff. Eventually pressing an exit key will end this routine when the results of the menu navigation will be returned to your script
  5. Your script should then react to the data returned by the menu. Most of the time this processing will be fairly trivial but if you built a complex menu with lists and data fields for editing, the return value may be quite complicated to deal with
  6. You can continue this process until you no longer need the module when menu_terminate should be called. This will closedown Curses so that screen I/O will return to normal. You can continue user interaction if you wish but none of the Cmenu or Curses functions should be used.


next up previous contents
Next: Sample Script Up: How to use Cmenu Previous: How to use Cmenu   Contents
Andy Ferguson (AFC) 2001-10-20