Gets the cursor and window coordinates.
Curses Library (libcurses.a)
The getbegyx macro stores the absolute screen coordinates of the specified window's origin in y and x.
The getmaxyx macro stores the number of rows of the specified window in y and x and stores the window's number of columns in x.
The getparyx macro, if the specified window is a subwindow, stores in y and x the coordinates of the window's origin relative to its parent window. Otherwise, -1 is stored in y and x.
The getyx macro stores the cursor position of the specified window in y and x.
Item | Description |
---|---|
*win | Identifies the window to get the coordinates from. |
Y | Returns the row coordinate. |
X | Returns the column coordinate. |
For the getbegyx subroutine:
To obtain the beginning coordinates for the my_win window and store in integers y and x, use:
WINDOW *my_win;
int y, x;
getbegyx(my_win, y, x);
For the getmaxyx subroutine:
To obtain the size of the my_win window, use:
WINDOW *my_win;
int y,x;
getmaxyx(my_win, y, x);
Integers y and x will contain the size of the window.