Basic question about windows...

  • Leandro Müller

    Leandro Müller - 2011-01-20

    Why isnt this working?

    #include <curses.h>
    int main()
        WINDOW *a;
        return 0;

    it should have made a window 40 by 12 at 0,0 with its background filled with dots but it isnt…
    i found out that if i add refresh() exactly after declaring WINDOW *a;
    it works…. why the heck if i didnt even initialize it with newwin???
    thanks a bunch

  • William McBrine

    William McBrine - 2011-01-20

    Your call to getch() is doing an implicit refresh(), which is to say, a wrefresh(stdscr) (getch() is really wgetch(stdscr)). Since stdscr covers the whole screen, refreshing it covers up your window. stdscr already exists without a newwin() call. Calling refresh() earlier updates stdscr so it's not touched when you implicitly refresh() it again.

    It's best not to mix and match the stdscr-oriented functions and the window-oriented functions - if you're going to create your own windows, then pretend stdscr doesn't exist. In your case, use wgetch(a) rather than getch().

  • Leandro Müller

    Leandro Müller - 2011-01-20

    aighty mate
    understand, made some changes here and it works like a charm ;)
    Btw how can i output special characters like ü? or é, á, ö… thank you once more!

  • Leandro Müller

    Leandro Müller - 2011-01-20

    oh forget it, i recompiled pdcurses with WIDE=wide and it worked ;)


Log in to post a comment.