bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reading characters from WIN*; saving and restoring window cursor


From: Thomas Dickey
Subject: Re: Reading characters from WIN*; saving and restoring window cursor
Date: Fri, 26 Jul 2002 14:25:32 -0400
User-agent: Mutt/1.2.5i

On Fri, Jul 26, 2002 at 04:58:47PM +0100, Walter Briscoe wrote:
> I have an application running on an AIX curses port with which I am not quite
> happy.  I would like to read the character and attributes at an arbitrary
> position in a window.  To me, it seems perverse to duplicate the information
> in the window by holding a copy of it in my own code.
> 
> mvwinch(win, y, x) gives me that information at the cost of changing the
> cursor position.
> 
> I can save and restore the cursor position within a window by
> manipulating win->_cury and win->_curx. This seems a vile hack.

getyx() returns this information.  Actually - almost all of the positioning
information can be read/written via the normal curses macros and functions.
(I noticed that _begx/_begy are neglected).

Something like this is certainly preferable:

int mywinch(WINDOW *win, int y, int x)
{
        int result;
        int save_y, save_x;
        getyx(win, save_y, save_x);
        result = mvwin(win, y, x);
        wmove(win, save_y, save_x);
        return result;
}
 
-- 
Thomas E. Dickey <address@hidden>
http://invisible-island.net
ftp://invisible-island.net



reply via email to

[Prev in Thread] Current Thread [Next in Thread]