Thread: NCurses: Problem with bckg colors

  1. #1
    Registered User
    Join Date
    Jan 2004
    Posts
    7

    NCurses: Problem with bckg colors

    Hi All!

    I've got question about Ncurses (I'm totally new to this stuff).

    I would like to create a red dialog box on a green background. The green window is stdscr, the box is a subwindow.

    I can make stdscr green that's ok, but the red bckg color in subwin only appears in non-blank areas. The blank part of subwin will be displayed in green, no matter what routine (bkgd, bkgdset, attron etc) I use.

    Does anybody know how to fix this? Please help me out!

    Here is my code:

    Code:
    #include <curses.h>
    
    int main() {
    
    chtype c='-'|COLOR_PAIR(1);
    
    WINDOW *tw1;
    
    initscr();
    cbreak();
    start_color();
    
    init_pair(1,COLOR_WHITE,COLOR_RED);
    init_pair(2,2,2);
    
    tw1 = subwin(stdscr,10,53,5,14);
    
    wattron(tw1,COLOR_PAIR(1));
    bkgd(ACS_BLOCK|COLOR_PAIR(2));
    
    box(stdscr,ACS_VLINE,ACS_HLINE);
    
    waddstr(tw1,"Some text goes here..");
    
    touchwin(stdscr);
    wrefresh(tw1);
    refresh();
    delwin(tw1);
    
    endwin();
    
    }
    Thank you in advance!
    Last edited by Karl; 01-19-2004 at 02:31 AM.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Fill your window with spaces.

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Jan 2004
    Posts
    7
    Ok, it works now. Thanks! for the help!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  2. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  3. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM
  4. Yet another lame program -- ncurses problem
    By w00tw00tkab00t in forum C Programming
    Replies: 2
    Last Post: 01-08-2006, 02:48 PM
  5. Replies: 5
    Last Post: 11-07-2005, 11:34 PM