使用ncurses刷新重叠窗口

4

我创建了一个弹出窗口,它重叠在其他窗口之上,我对其进行了修改,然后将其删除。但是,当我这样做时,背景窗口保留了空白的空间。

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

 }

编辑: 根据http://linux.die.net/man/3/touchwin所述,在刷新之前使用touchwin(stdscr)应该可以解决问题,但实际上没用。


1
您可能需要查看面板库(ncurses的一部分),它提供了管理重叠和堆叠窗口的例程。 - Craig
1个回答

2
我看到了我的问题,我创建了一个子窗口,但我需要创建一个新的窗口。 当我测试主窗口是否发生了更改时,使用is_wintouched函数,在删除子窗口之后才返回true,我不知道为什么。
这个窗口是在原始窗口的中间创建的,因此对一个窗口所做的更改将影响到两个窗口。http://linux.die.net/man/3/subwin

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接