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

Fetching and changing a menu's display attributes

Menu display attributes are visible menu characteristics that distinguish classes of menu items from each other. Low-level ETI (curses) video attributes are used to differentiate the menu display attributes. These menu display attributes include


foreground attribute
distinguishes the current item, if selectable, on all menus and selected items on multi-valued menus

background attribute
distinguishes selectable, but unselected, items on all menus

grey attribute
distinguishes unselectable items on multi-valued menus

pad character
the character that fills (pads) the space between a menu item's name and description
The following functions enable you to set and read these attributes.

SYNOPSIS

   int set_menu_fore (menu, attr)
   MENU * menu;
   chtype attr;
   

chtype menu_fore (menu) MENU * menu;

int set_menu_back (menu, attr) MENU * menu; chtype attr;

chtype menu_back (menu) MENU * menu;

int set_menu_grey (menu, attr) MENU * menu; chtype attr;

chtype menu_grey (menu) MENU * menu;

int set_menu_pad (menu, pad) MENU * menu; int pad;

int menu_pad (menu) MENU * menu;

In general, to establish uniformity throughout your program, you should set the menu display attributes with these functions at the start of the program.

Function set_menu_fore sets the curses foreground attribute. The default is A_STANDOUT.

Function set_menu_back sets the curses background attribute. The default is A_NORMAL.

Function set_menu_grey sets the curses attribute used to display nonselectable items in multi-valued menus. The default is A_UNDERLINE.

To set the foreground attribute of menu m to A_BOLD and its background attribute to A_DIM, you write

   MENU *m;
   

set_menu_fore(m,A_BOLD); set_menu_back(m,A_DIM);

All these functions can change or fetch the current default if passed a NULL menu pointer. As an example, to set the default grey attribute to A_NORMAL, you write
   set_menu_grey((MENU *)0, A_NORMAL);
If functions set_menu_fore, set_menu_back, and set_menu_grey encounter an error, they return one of the following:

E_SYSTEM_ERROR
system error

E_BAD_ARGUMENT
bad curses attribute
Function set_menu_pad sets the pad character for a menu. The initial default pad character is a blank. The pad character must be a printable ASCII character.

To change the pad character for menu m to a dot (.), you write

   MENU * m;
   

set_menu_pad(m,'.');

If function set_menu_pad encounters an error, it returns one of the following:

E_SYSTEM_ERROR
system error

E_BAD_ARGUMENT
non-printable pad character

Next topic: Posting and unposting menus
Previous topic: Creating a menu with a border

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