next up previous contents
Next: Modifying user_panels.c Up: Writing the Required Routines Previous: example_go()   Contents

example_handler()

The handler routine is required by the windowing system and must be declared in the following way. It will be passed in two objects - a Menu_item and a Menu_generate. These are special XView window objects and the user should refer to The XView Programming Manual [2] for more information. The important fact for this routine is that when the Menu_generate item has value equal to MENU_NOTIFY then the user has selected this option from the menu so the computational procedure should be called. The menu object types are declared in the file <xview/xview.h> which must be included into this C code file. The handler routine should also return the Menu_item object when it exits. The following code is a sample handler routine.

 
#include <xview/xview.h>     /* include the xview declarations for        */
                             /* Menu_item, Menu_generate, and MENU_NOTIFY */

/*
 * example_handler()
 *
 * Menu handler for `panelmenu (Example)'. 
 */ 
Menu_item 
  example_handler(item, op)
Menu_item item;
Menu_generate op; 
{
  if (op == MENU_NOTIFY) 
    {
      example_go();
    } 
  return item;
}



root
1998-11-02