Unix Programming - curses: saving and restoring window chars/colours

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > November 2005 > curses: saving and restoring window chars/colours





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author curses: saving and restoring window chars/colours
Simon Elliott

2005-11-22, 7:50 am

I'm using curses and opening a new window with newwin() and closing it
with delwin(). The only trouble is, when I call delwin(), the window's
contents are still displayed on the screen.

Is there any way of saving what would be under the new window, and
restoring it after the new window is closed? The new window is always
opened on top of the main stdscr window.

I see in the man pages that there's a scr_dump() and scr_restore()
which might do what I want. but these expect to use files, and I'd like
to store the screen state in memory instead.

--
Simon Elliott http://www.ctsn.co.uk
Thomas Dickey

2005-11-22, 7:50 am

Simon Elliott <Simon at ctsn.co.uk> wrote:
> I'm using curses and opening a new window with newwin() and closing it
> with delwin(). The only trouble is, when I call delwin(), the window's
> contents are still displayed on the screen.


For this case, you would touch the window that you want to redisplay.
The panel library does this in general, but touchwin/wrefresh work
for special cases.

> Is there any way of saving what would be under the new window, and
> restoring it after the new window is closed? The new window is always
> opened on top of the main stdscr window.


You can retrieve a window's contents line-by-line or character-by-character
using one of the insstr/innwstr/inchnstr or inch variants.

> I see in the man pages that there's a scr_dump() and scr_restore()
> which might do what I want. but these expect to use files, and I'd like
> to store the screen state in memory instead.


> --
> Simon Elliott http://www.ctsn.co.uk


--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
Simon Elliott

2005-11-22, 7:50 am

On 22/11/2005, Thomas Dickey wrote:

> For this case, you would touch the window that you want to redisplay.
> The panel library does this in general, but touchwin/wrefresh work
> for special cases.


Thanks. I was wondering if I'd have to make a pad and call overwrite()
to save the data, but this is much simpler.

--
Simon Elliott http://www.ctsn.co.uk
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com