DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
ETI menus

Counting the number of menu items

Occasionally, you may want to do different processing depending on the number of items connected to your current menu. Function item_count returns the number of items connected to a menu.

SYNOPSIS

   int item_count (menu)
   MENU * menu;
If menu is NULL, function item_count returns -1.

As an example of the use of this function, consider the following routine. Because the index to the last menu item is one less than the number of items, this routine determines whether the last item is displayed.

   int at_bottom (m) /* check visibility of last
       menu item */
   MENU * m;
   {
   	ITEM ** i = menu_items (m);
   	ITEM * lastitem = i[item_count(m)-1];
   

return item_visible (lastitem); }


Next topic: Changing the current default values for menu attributes
Previous topic: Changing the items associated with a menu

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