Writing a Row of Attributes

If you want to highlight a word, phrase, or row of the window, first move the virtual cursor to the position you want highlighted, then use the video attribute quantity function, v_attq():

int v_attq(att, q, wnp)
 
UCHAR att;
/* Attribute to write to window
*/
int q;
/* Number attributes to write
*/
WINDOWPTR wnp;
/* Pointer to window to write to 
*/

For q, you can specify a number of characters to write, or ENDROW or ENDWN to write the attribute to the end of the row or the end of the window buffer, respectively.

Output starts at the virtual cursor position and continues on the row until the specified number of attributes is written. If the end of the row is reached and there are still more attributes to write, output goes to the beginning of the next row. When the end of the window buffer is reached, output stops. The window write options are not respected, so no scrolling occurs and the virtual cursor does not move.

For example, the following code highlights the phrase "read the manual" in the window ex_wnp:

ex_wnp = wn_def(0, 0, 10, 35, LNORMAL, BDR_DOTP);

wn_up(ex_wnp);

v_st("If you don't know how to do this, read the manual.", ex_wnp);

cs_mv(0, 33, ex_wnp);

v_attq(LREVERSE, 15, ex_wnp);

Alternatively, you can place the virtual cursor and write the attribute with one call to v_chattrow():

v_chattrow(0, 33, NULLPARM, LREVERSE, 15, ATT, ex_wnp);

Since the move type is specified as ATT, the character, passed in the third parameter, will be ignored. In this case, NULLPARM, which is #defined as a NULL parameter, is used to clearly illustrate that the character is ignored.


Home Contents Previous Next