Moving the Virtual Cursor and the Physical Cursor Together

When you explicitly change the virtual cursor position, either by a call to cs_mv() or by direct assignment, the physical cursor does not move to the new virtual cursor location, even if the automatic physical cursor placement option is on. If you want to move both the virtual and physical cursor to a new location, use the move cursors in window function, csr_mvwn():

int csr_mvwn(wn_row, wn_col, wnp)
 
int wn_row;
/* Window row to move cursors to
*/
int wn_col;
/* Window column to move cursors to
*/
WINDOWPTR wnp;
/* Pointer to a window
*/

In the following code example, let's assume that the virtual cursor advance option has been turned off.

wn_up(ex_wnp);

v_st("Do you wish to continue? ", ex_wnp);

csr_mvwn(0, 23, ex_wnp);

The string "Do you ..." is written to the window starting at a virtual cursor position of (0, 0). The physical cursor remains where it was when wn_up() was called. After the string is written, the virtual cursor and the physical cursor are still at (0, 0). The csr_mvwn() moves both to the end of the text written to the window.


Home Contents Previous Next