ant@mks.com (Anthony Howe) (06/21/91)
What is the correct way to use overlay() and overwrite(). Are they what I need? I want to display a dialogue box, then later remove it from the screen restoring whatever was covered. The catch is that I want the dialogue box to do the refresh and maintain independence by not having any knowledge of other windows other than curscr. -- ant@mks.com Anthony C Howe Mortice Kern Systems Inc. 35 King St. N., Waterloo, Ontario, Canada, N2J 6W9 "Fate favors fools, small children, and ships named Enterprise" - Riker
jfv@cbnewsk.att.com (j.f.van valkenburg) (06/21/91)
In article <1991Jun20.170834.8080@mks.com>, ant@mks.com (Anthony Howe) writes: > > What is the correct way to use overlay() and overwrite(). Are they what > I need? I want to display a dialogue box, then later remove it from the > screen restoring whatever was covered. The catch is that I want the > dialogue box to do the refresh and maintain independence by not having > any knowledge of other windows other than curscr. > > -- > ant@mks.com Anthony C Howe > Mortice Kern Systems Inc. 35 King St. N., Waterloo, Ontario, Canada, N2J 6W9 > "Fate favors fools, small children, and ships named Enterprise" - Riker Instead of flipping windows as in overlay, try openning a new window altogether. By making a new window you can do a wrefresh(newwin) to update just one window or wnoutrefresh(newwin) and do everything with a refresh(). The two windows,stdscr and newwin, will be totally independent of each other and cursor addressing will be dependent on the window addressed. ------------------------ James F. Van Valkenburg a.k.a. "van" AT&T Attmail: !jfv jfv@cbnewsk.att.com Atlanta, GA. Voice 404-810-7920 =============================================================================== ---- Standard Disclaimers included -- Just another grunt at AT&T ---- ===============================================================================
ant@mks.com (Anthony Howe) (06/22/91)
jfv@cbnewsk.att.com (j.f.van valkenburg) writes: >In article <1991Jun20.170834.8080@mks.com>, ant@mks.com (Anthony Howe) writes: >> >> What is the correct way to use overlay() and overwrite(). Are they what >> I need? I want to display a dialogue box, then later remove it from the >> screen restoring whatever was covered. The catch is that I want the >> dialogue box to do the refresh and maintain independence by not having >> any knowledge of other windows other than curscr. > >Instead of flipping windows as in overlay, try openning a new window altogether. > >By making a new window you can do a wrefresh(newwin) to update just one >window or wnoutrefresh(newwin) and do everything with a refresh(). > >The two windows,stdscr and newwin, will be totally independent of each other and >cursor addressing will be dependent on the window addressed. I do this, but the problem is refreshing the screen in order to remove the top most window. If you have several routines each opening windows on top of each other, how do you tell them to redraw their windows? First I tried a window stacking structure. Works but requires that the routines register the window on the stack. I then sat back and read the System V man pages on overlay(), overwrite(), copywin(), and dupwin(). This is the solution I came up with for the dialogue routine. int dailogue(msg) char *msg; { WINDOW *dial; WINDOW *covered; ... dail = newwin(height, width, row, col); /* Make a exact size duplicate of the dialogue window. * Another newwin() could be done with the same dimensions, * but I wanted to test our in-house CURSES that I maintain. */ covered = dupwin(dail); /* Save the region from curscr that will be covered. */ overwrite(curscr, covered); /* Do what ever. */ ... delwin(dail); /* Restore the covered region. */ overwrite(covered, curscr); delwin(covered); /* Restore the screen so that all other routines think that the * window is as they left it. */ wrefresh(curscr); return (result); } -- ant@mks.com Anthony C Howe Mortice Kern Systems Inc. 35 King St. N., Waterloo, Ontario, Canada, N2J 6W9 "Fate favors fools, small children, and ships named Enterprise" - Riker