[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Possible problem with wchgat???
From: |
Brian Raiter |
Subject: |
Re: Possible problem with wchgat??? |
Date: |
Wed, 23 Jan 2002 19:53:11 -0800 (PST) |
> In the sample below, I expected the color of the "A" at 5x5 to change to
> YELLOW on RED. Try as I might, I just can't get it to happen. Here's
> the example code:
chgat() doesn't mark the cell as needing to be updated. (I don't know
if this is intended behavior or not.)
Inserting a touchwin() before the second wrefresh() gets the behavior
you seek.
b
> #include <curses.h>
>
> int
> main( int argc, char *argv[] )
> {
> WINDOW *wstat;
>
> initscr();
> start_color();
> noecho();
> init_pair( 1, COLOR_YELLOW, COLOR_BLUE );
> init_pair( 2, COLOR_YELLOW, COLOR_RED );
>
> wstat = newwin( 0, 0, 0, 0 );
>
> mvwaddch( wstat, 5, 5, 'A' | A_BOLD | COLOR_PAIR( 1 ) );
> mvwaddch( wstat, 9, 9, 'Z' | A_BOLD | COLOR_PAIR( 2 ) );
> wrefresh( wstat );
> mvwgetch( wstat, 7, 7 );
>
> mvwchgat( wstat, 5, 5, 1, A_BOLD, 2, NULL );
> wrefresh( wstat );
> mvwgetch( wstat, 7, 7 );
>
> delwin( wstat );
> endwin();
>
> return 0;
> }