ETI menus

Fetching and changing menu items

During processing, you may sometimes want to change the set of items connected to a menu. Function set_menu_items enables you to do this.


   int set_menu_items (menu, items)
   MENU * menu;
   ITEM ** items;

ITEM ** menu_items (menu) MENU * menu;

Like the argument to new_menu, the second argument to set_menu_items is a NULL-terminated, ordered array of ITEM pointers that defines the items on the menu. Like new_menu, function set_menu_items does not copy the array of item pointers. Instead, it saves the pointer to the array for future use.

The items previously connected to the given menu when set_menu_items is called are disconnected from the menu (but not freed) before the new items are connected. The new items cannot be given to other menus unless first disconnected by free_menu or another set_menu_items call.

If items is NULL, the items associated with the given menu are disconnected from it, but no new items are connected.

If function set_menu_items is successful, it returns E_OK. If it encounters an error, it returns one of the following:

system error

NULL menu pointer or NULL associated item array

menu is posted

connected item

Function menu_items returns the array of item pointers associated with its menu argument. In the next section, the application-defined function at_bottom illustrates its use.

If no items are connected to the menu or the menu pointer argument is NULL, menu_items returns NULL.

As an example of set_menu_items, consider ``Changing the items associated with a menu'' whose code changes the items associated with a previously created menu.

   MENU *m;
   ITEMS ** olditems, ** newitems;
                                  /* create items */

m = new_menu(olditems); /* create menu m */

/* process menu with olditems */

set_menu_items (m,newitems); /* change items associated with menu m */

Changing the items associated with a menu

Next topic: Counting the number of menu items
Previous topic: Manipulating menu attributes

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004