Centering and Justifying Output in a Window

By using special #defined values for the column value in the call to v_stpl() and v_stattpl(), you can center, right-justify, or left-justify your string output. The #defined values available are:

CENTER_TEXT Centers the specified string in the window buffer.
RIGHT_TEXT Right justifies the string in the window buffer.
LEFT_TEXT Left justifies the string in the window buffer.

For example, to center the string "Hello, world!" in the fourth row (row number 3) of the buffer associated with the window ex_wnp, call:

v_stpl(3, CENTER_TEXT, "Hello, world!", ex_wnp);

When right-justification is specified, the last character of the string is placed in the right-most position of the specified window buffer row. When left-justification is specified, the first character of the string is placed in the left-most position of the specified window buffer row. If the string is too long and cannot be centered or right-justified, the function will start output in the first column of the specified row of the buffer.


Home Contents Previous Next