Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Refresh overlapping windows using ncurses

Tags:

c++

ncurses

I create a pop-up window that overlaps other windows, I alter it and then delete it. But when I do this the background window keeps the blank spaces.

popup(){
    WINDOW* backgroundWin = subwin(stdscr,0,0,100,100);
    //fill it with something
    WINDOW* popupWin = subwin(stdscr,50,50,10,10);
    werase(popupWin);       //so it doesn't look 'transparent'
    box(popupWin,0,0);
    wrefresh(popupWin);

    getch();

    werase(popupWin);
    delwin(popupWin);

    refresh(); //when I do this refresh the contents of the popup window stay, in this case blank spaces because I used werase

 }

EDIT: According to this using touchwin(stdscr) before refresh should work, but it doesn't http://linux.die.net/man/3/touchwin

like image 853
Hohenheimsenberg Avatar asked May 07 '26 14:05

Hohenheimsenberg


1 Answers

I see my problem, I was creating a subwindow when I need to create a new window. When I tested where the main window was changed, using is_wintouched, it returned true only after deleting the subwindow, I don't know why.

The window is made in the middle of the window orig, so that changes made to one window will affect both windows. http://linux.die.net/man/3/subwin

like image 130
Hohenheimsenberg Avatar answered May 09 '26 04:05

Hohenheimsenberg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!