[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: color in subwindows

From: D. Stimits
Subject: Re: color in subwindows
Date: Mon, 16 Jun 2003 17:34:32 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2b) Gecko/20021018

Thomas Dickey wrote:

On Mon, Jun 16, 2003 at 05:05:30PM -0600, D. Stimits wrote:

>I'm trying to use wbkgd(), with a different wbkgd() in different
>subwindows, recursively. These are also inside of a panel. So I might
>have a panel with a subwindow that has a border, and a useful subwindow
>inside of the border; this in turn might have a temporary "pop up" style
>subwindow inside of it, and I want to set wbkgd() separately for each
>subwindow. Unfortunately, I seem to be doing something wrong, and the
>final wbkgd() (although called for the specific subwindow and not for
>the parent window) seems to be the color that results for all windows up
>to the parent. I wanted to verify that ncurses should be able to set
>(separately) the background properties of each subwindow within a
>parent, recursively. Should I be able to set colors up like this
>(therefore my code is in error), or am I simply finding a restriction?

I always have to check the manpage to keep these straight.
If you're using subwin rather than newwin, that's likely the

       Calling subwin creates and returns a pointer to a new win-
       dow with the given number of lines, nlines,  and  columns,
       ncols.   The  window  is at position (begin_y, begin_x) on
       the screen.  (This position is relative to the screen, and
       not to the window orig.)  The window is made in the middle
       of the window orig, so that changes  made  to  one  window
       will  affect  both  windows.   The subwindow shares memory
with the window orig.

Here is the million dollar question (or maybe 2 cents): They share memory for character data within the smaller subwindow. However, I assume that the subwindow and parent window have separate properties for the background. Thus if I set window "outer" to blue background, and window "inner" to red background, that if I refresh "outer" first, and then "inner", that "outer" should be blue, and "inner" should be red. I'm finding though that setting "inner" to red results in all parents to also be red. It looks like subwindows and their parents are unable to have separate background attributes, regardless of refresh order. It is like they are not really two separate windows sharing an intersection of character cells...they seem to also be the same attribute setting for background color, like two pointers pointing at the same value.

D. Stimits, stimits AT attbi DOT com

PS: What are the chances that the wprintw family can be fixed to keep the fmt const char* instead of just char*? I know curses.h says they are const, but the actual functions are throwing the const away (according to the g++ compiler, which rejects 100% of passing a const to a non-const argument position). Ncurses is not altering these values, but merely having it declared as non-const breaks compiles, so I have to do a strdup(std::string.c_str()) and passing the dup to all print functions taking char*, then deallocating the dup. The generated functions are discarding const.

 When using this routine, it is nec-
       essary  to call touchwin or touchline on orig before call-
       ing wrefresh on the subwindow.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]