getsyx Subroutine

Purpose

Retrieves the current coordinates of the virtual screen cursor.

Library

Curses Library (libcurses.a)

Syntax

#include <curses.h>

getsyx(Y, X)
int * Y, * X;

Description

The getsyx subroutine retrieves the current coordinates of the virtual screen cursor and stores them in the location specified by Y and X. The current coordinates are those where the cursor was placed after the last call to the wnoutrefresh, pnoutrefresh, or wrefresh, subroutine. If the leaveok subroutine was TRUE for the last window refreshed, then the getsyx subroutine returns -1 for both X and Y.

If lines have been removed from the top of the screen using the ripoffline subroutine, Y and X include these lines. Y and X should only be used as arguments for the setsyx subroutine.

The getsyx subroutine, along with the setsyx subroutine, is meant to be used by a user-defined function that manipulates curses windows but wants the position of the cursor to remain the same. Such a function would do the following:

Parameters

Item Description
X Points to the current row position of the virtual screen cursor. A value of -1 indicates the leaveok subroutine was TRUE for the last window refreshed.
Y Points to the current column position of the virtual screen cursor. A value of -1 indicates the leaveok subroutine was TRUE for the last window refreshed.