[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

General Programming Concepts:
Writing and Debugging Programs

Controlling the Cursor with Curses

The following types of cursors exist in the curses library:

logical cursor The cursor location within each window. A window's data structure keeps track of the location of its logical cursor. Each window has a logical cursor.
physical cursor The display cursor. The workstation uses this cursor to write to the display. There is only one physical cursor per display.

You can only add to or erase characters at the logical cursor in a window. The following subroutines are provided for controlling the cursor:

getbegyx Places the beginning coordinates of the window in integer variables y and x.
getmaxyx Places the size of the window in integer variables y and x.
getsyx Returns the current coordinates of the virtual screen cursor.
getyx Returns the position of the logical cursor associated with a specified window.
leaveok Controls physical cursor placement after a call to the wrefresh subroutine
move Moves the logical cursor associated with the stdscr
mvcur Moves the physical cursor
setsyx Sets the virtual screen cursor to the specified coordinate
wmove Moves the logical cursor associated with a user-defined window

After a call to the refresh or wrefresh subroutine, curses places the physical cursor at the last updated character position in the window. To leave the physical cursor where it is and not move it after a refresh, call the leaveok subroutine with the Window parameter set to the desired window and the Flag parameter set to TRUE.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]