bug-ncurses
[Top][All Lists]
Advanced

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

RE: help with panels


From: Jürgen Pfeifer
Subject: RE: help with panels
Date: Sun, 30 Dec 2001 00:51:22 +0100

Although panels provide a "depth" dimension to the curses windows, they don't 
provide their own store. They use the windows associated with them to render 
the data that belong to the panel. If you use two panels with the same window - 
as you do with your sample - then the data will always be visible because 
ultimately the content of the window belonging to the panel on the top is 
displayed. Use separate windows for separate panels and you'll see the desired 
effect.

Cheers
Jürgen


> 
> clearly, i'm not understanding something.  the code below is the
> shortest hello world i can think of to demonstrate panels.  what i was
> hoping it would do is print "hello world", then hide it.
> 
> my understanding is this:
>   * create a window
>   * create a panel (p1) on top of the window
>   * create another panel (p2) on top of the same window.  now p2 is
>      on top of p1.
>   * print "hello world" on w1.  it should go to the top panel.
>   * hide p2, show p1.  update.  "hello world" should vanish.
> 
> clearly, this isn't happening.  can someone help me out?   is there a
> collection of "hello world" type programs to demonstrate certain
> features of ncurses?
> 
> thanks!
> pete
> 
> 
> #include <ncurses.h>
> #include <panel.h>
> 
> int main(void)
> {
>       WINDOW *w1;
>       PANEL *p1, *p2;
>       int c;
> 
>       initscr();
>       w1 = newwin(6, 5, 0, 0);
>       p1 = new_panel(w1);
>       p2 = new_panel(w1);   /* p2 is on top */
> 
>       wprintw(w1, "hello panel world\n");
> 
>       c = wgetch(w1);
>       hide_panel(p2);
>       show_panel(p1);
>       /* don't use w*refresh with panels */
>       update_panels(); /* update screen */
>       doupdate();  /* update physical screen */
> 
>       del_panel(p1);
>       del_panel(p2);
>       delwin(w1);
>       endwin();
>       return 0;
> }
> 
> _______________________________________________
> Bug-ncurses mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/bug-ncurses




reply via email to

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