Then look at the hidden and display panel
Dp @ dp :~ /Cursestest % cat x. c
# Include
Int main ()
{
WINDOW * my_wins [3];
PANEL * my_panels [3];
Int lines = 10, cols = 40, y = 2, x = 4, I;
Int ch;
Initscr ();
Cbreak ();
Noecho ();
/* Create a window for each panel */
My_wins [0] = newwin (lines, cols, y, x );
My_wins [1] = newwin (lines, cols, y + 1, x + 5 );
My_wins [2] = newwin (lines, cols, y + 2, x + 10 );
/* Add a border for the window so that you can see the effect of the Panel */
For (I = 0; I <3; ++ I)
Box (my_wins [I], 0, 0 );
/* Associate a window for each panel in the order of bottom-up */
My_panels [0] = new_panel (my_wins [0]);
/* Press the Panel 0 into the stack and stack it in sequence: stdscr0
*/
My_panels [1] = new_panel (my_wins [1]);
/* Press panel 1 into the stack, stacked in sequence: stdscr01
*/
My_panels [2] = new_panel (my_wins [2]);
/* Press panel 2 into the stack and stack it in sequence: stdscr012 */
/* Update the stack sequence. Place panel 2 on the top of the stack */
Update_panels ();
/* Display on screen */
Doupdate ();
// Exit q. Press the 1-3 key to display and hide the corresponding panel.
Int isshow [3] = {1, 1 };
While (ch = getch ())! = 'Q ')
{Switch (ch)
{
Case '1 ':
If (++ isshow [0]) % 2) show_panel (my_panels [0]);
Else hide_panel (my_panels [0]);
Break;
Case '2 ':
If (++ isshow [1]) % 2) show_panel (my_panels [1]);
Else hide_panel (my_panels [1]);
Break;
Case '3 ':
If (++ isshow [2]) % 2) show_panel (my_panels [2]);
Else hide_panel (my_panels [2]);
Break;
}
Update_panels ();
Doupdate ();
}
Getch ();
Endwin ();
}
All contents of the good AI Park blog is original, if reproduced please indicate the source http://blog.csdn.net/myhaspl/
After execution
Dp @ dp :~ /Cursestest % gcc-lncursesw-lpanel x. c-o mytest
Dp @ dp :~ /Cursestest %./mytest
For example, to hide panel 2, the effect is as follows: