HPlogo MPE/iX Developer's Kit Reference Manual Volume 2: HP 3000 MPE/iX Computer Systems > Chapter 4 CURSES

bkgdset wbkgdset bkgd wbkgd

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

The bkgdset set of routines is used to set the background character (and attributes) of a window.

Syntax

   #include <curses.h>



   void bkgdset(chtype ch);

   void wbkgdset(WINDOW *win, chtype ch);



   int bkgd(chtype ch);

   int wbkgd(WINDOW *win, chtype ch);

Parameters

ch

A pointer to the background character to be set.

win

A pointer to the window in which the background character is to be set.

Return Values

OK

Successful completion.

ERR

An error occurred.

Description

A window is made up of foreground and background attributes. All characters except space are part of the foreground. The character and its attributes make up a character/attribute pair defined as a chtype. The character is any 16-bit value; the attribute consists of highlighting attributes that affect the appearance of the character on the screen (for example, bold, underline).

Each time a character, other than a space, is written to a window with waddch(), wprintw(), or waddstr(), a bitwise OR operation is performed between the chtype (foreground character with its attributes), the current foreground attributes of the window, and the current background attributes of the window. The current foreground attributes are set with wattrset(), wattron(), and wattroff(); the current background attributes are set with wbgdset(). When spaces are written to the screen, the background character and attributes replace the space. For example, if the background attribute and character is

   A_UNDERLINE|'*'

text written to the window appears underlined and the spaces appear as underlined asterisks.

After the OR operation, each character written retains the new foreground and background attributes that it has obtained. This allows the character to be copied "as is" to a window with the waddchstr() or insch() routines.

The bkgdset() routine sets the current background character and attributes for the stdscr window; wbgdset() sets the current background character and attributes for window win. You must specify the complete character/attribute pair; for example:

    bkgdset(A_BOLD|' ');

sets the background attribute as bold and the background character as a space. The default background character/attribute pair is

    bkgdset(A_NORMAL|' ');
NOTE: The current background character and attributes are written to the window by the wclear(), werase(), cltroeol(), and cltrobot() routines as well as any other routines that insert blanks. If a background character is not supplied (that is, only an attribute is given), results are undefined.

The bkgd() and wbkgd() routines update the entire window (stdscr and win, respectively) with the supplied background and perform a wbkgdset().

NOTE: The bkgd(), wbkgd(), and bkgdset() routines are macros.

Implementation Considerations

UNIX System V implementation

See Also

addch(), attroff(), attron(), waddchstr(), wattrset(), winsch()

Portability

UNIX System V

Feedback to webmaster