bug-ncurses
[Top][All Lists]
Advanced

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

help with panels


From: Peter Jay Salzman
Subject: help with panels
Date: Sat, 29 Dec 2001 08:37:33 -0800
User-agent: Mutt/1.3.24i

hi all,

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;
}



reply via email to

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