本文介绍了使用更多的行比窗口与ncurses的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近一直推出的ncurses 异步键盘按键倾听,并与它很有进步。有一个问题我面对的是,你只能有可视屏幕,没有滚动条上的文字。我在想,如果可以使用,以保持的ncurses ,因为它是那么可爱,但该程序仍保持滚动条,而不是让最后一行,并在那里停留。

I have recently been introduced to ncurses for asynchronous keyboard key listening, and getting on well with it. One issue i'm facing is that you can only have text on the visible screen, no scrollbars. I was wondering if its possible to keep using ncurses as it is so lovely, but have the program still keep the scrollbars rather than getting to the last line and staying there.

推荐答案

。你必须先设置scrollok(赢,TRUE)。其实,如果你只是想喷出像一个正常的终端数据,你只需要设置的。

scroll(). You have to set scrollok(win, TRUE) first. Actually if you just want to spew data like a normal terminal you only need to set scrollok() by itself.

#include <ncurses.h>

int main(void)
{
    int i = 0;

    initscr();

    scrollok(stdscr,TRUE);

    while(1)
    {
        printw("%d - lots and lots of lines flowing down the terminal\n", i);
        ++i;
        refresh();
    }

    endwin();
    return 0;
}

这篇关于使用更多的行比窗口与ncurses的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-13 14:56