Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought



     ITEM(S)                   UNIX System V                   ITEM(S)



     Name
          item - CRT item routines

     Syntax
          #include <menu.h>

          cc [ flags ] files -lmenu -lcurses [ libraries ]
          ITEM *new_item(n, d)
          ITEM * item;
          char *n, *d;

          int free_item(i)
          ITEM * i;

          char *item_name(i)
          ITEM * i;

          char *item_description(i)
          ITEM * i;

          int set_item_opts(i, o)
          ITEM * item;
          OPTIONS o;

          OPTIONS item_opts(i)
          ITEM * i;

          int item_opts_on (item, opts)
          ITEM * item;
          OPTIONS opts;

          Int item_opts_off (item, opts)
          ITEM * item;
          OPTIONS opts;

          int set_item_value(i, c)
          ITEM * item;
          int *c;

          int item_value(i)
          ITEM * item;

          int set_item_userptr(i, n)
          ITEM * item;
          char *n;

          char *item_userptr(i)
          ITEM * i;

          int item_count(m)
          MENU *m;
          int item_visible(i)
          ITEM * item;


     Description
          These routines allow you to create, display, and access
          items.  Menus can be displayed on any display device
          supported by the low-level
           () library curses(S).  Once you compile your program
          includeing the ITEM header file menu.h, you should link it
          with the ITEM and curses library routines.

     Functions
          new_item ( n , d ) creates a new item with name n and
          description d.  It returns a pointer to the new item.  In
          general, you should store these item field pointers in an
          array.

          free_item() frees the storage allocated for the given item.
          Once an item is freed, you can no longer connect it to a
          menu.

          item_name ( i ) returns a pointer to the given item's name.

          item_description ( i ) returns a pointer to the given item's
          description.

          set_item_opts ( i , o ) turns on the named option(s) for the
          item and turns off its remaining options, if any.  Options
          are boolean values.  Currently, there is one item option
          O_SELECTABLE which enables your end-user to select the item.
          The initial current default is to have O_SELECTABLE on for
          every item.

          item_opts ( i ) returns the given item's option(s) setting.
          To set options, you can apply boolean operators to the value
          returned by item_opts() and let the result be the second
          argument to set_item_opts().

          item_opts_on ( item , opts ) turns on the named options for
          the item.

          item_opts_off ( item , opts ) turns off the named options
          for the item.

          Unlike single-valued menus, multi-valued menus enable your
          end-user to select one or more items from a menu.
          set_item_value ( i , c ) sets the given item's select
          value-TRUE (selected) or FALSE (not selected).  To make a
          menu multi-valued, you use set_menu_opts() or
          menu_opts_off() to turn off option O_ONEVALUE.
          set_item_value() may be used only with multi-valued menus.
          item_value ( i ) returns the select value of the given item,
          either TRUE (selected) or FALSE (unselected).

          Every item has an associated user pointer that you can use
          to store pertinent information.  set_item_userptr ( i , n )
          sets the item's user pointer.

          item_userptr ( i ) returns the item's user pointer.

          item_count ( m ) returns the number of items in the given
          menu.

          A menu item is visible if it currently appears in the
          subwindow of the posted menu to which it is connected.  If
          an item is visible, item_visible ( i ) returns TRUE.  If
          not, it returns FALSE.

     See Also
          curses(S), field(S), fieldtype(S), form(S), menu(S),
          panel(S), tam(S)

     Diagnostics
          The following values are returned by one or more routines
          that return an integer.

          E_OK                routine returned normally

          E_SYSTEM_ERROR      system error

          E_BAD_ARGUMENT      an incorrect argument was passed to the
                              routine

          E_POSTED            menu is already posted

          E_CONNECTED         one or more items are connected to
                              another menu

          E_BAD_STATE         routine called from an inappropriate
                              routine

          E_NO_ROOM           menu does not fit within its subwindow

          E_NOT_POSTED        menu has not yet been posted

          E_UNKNOWN_COMMAND   unrecognizable request was given to the
                              driver

          E_NO_MATCH          no match occurred

          E_NOT_SELECTABLE    item cannot be selected

          E_NOT_CONNECTED     no items are associated with the menu

          E_REQUEST_DENIED    menu driver could not process the
                              request

                                             (printed 6/20/89)



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026