Canul Podkopayeva wrote:

> I have a problem with this thing...
> 
> I have a window that will be moving back and forth, it's something
> like...
> 
> /* I have the usuals setup already */
> waddstr(test, "This string looks weird!");
> mvwin(test, 1, 5);
> wrefresh(test);
> napms(300); /* 
>              * This is for them to get a chance
>              * to see the effect.
>              */
> mvwin(test, 1, 1);
> wrefresh(test);

>  /* I have this in a sort of a loop, but the problem is that it dosn't
> erase the text that it displays when it moves.

It wont; you're not refreshing the background.

> So I did a werase(test); but after that the window wouldn't appear
> again.

Unsurprising, as werase() erases the contents of the window.

> I also tried a refresh(); but that had no affect on it. */

It won't; refresh() copies stdscr to the terminal, but you're not
erasing stdscr. Call `erase()' or `werase(stdscr)' prior to calling
refresh(), e.g.

#include <curses.h>
#include <unistd.h>

int main(void)
{
        WINDOW *w;
        int i;

        initscr();

        w = newwin(1, 20, 0, 0);
        waddstr(w, "Hello, world!");

        for (;;)
                for (i = 0; i < 25; i++)
                {
                        mvwin(w, i, i);
                        erase();
                        refresh();
                        wrefresh(w);
                        napms(50);
                }

        endwin();

        return 0;
}

-- 
Glynn Clements <[EMAIL PROTECTED]>

Reply via email to