Moving the Virtual Cursor

When a window is set on the screen with wn_up(), the virtual cursor is automatically placed at the coordinates (0, 0), which is the upper left corner of the buffer. To move the virtual cursor to the window location where you want to write, use the move virtual cursor function, cs_mv():

void cs_mv(wn_row, wn_col, wnp)
 
int wn_row;
/* Window row to move virtual cursor
*/
int wn_col;
/* Window column to move virtual cursor
*/
WINDOWPTR wnp;
/* Pointer to a window
*/

For example, to write a string starting at row 3, column 5 of the example window:

WINDOWPTR ex_wnp;



char *stp = "This is easy.";

ex_wnp = wn_def(0, 0, 15, 80, LNORMAL, BDR_SLNP);

cs_mv(3, 5, ex_wnp);

v_st(stp, ex_wnp);

After the string is written, the virtual cursor will be located immediately after the last character written.


Home Contents Previous Next