C pointer principle (64)-Ncurses-text terminal graphics

Source: Internet
Author: User

Panel Library allows you to easily manage the Panel:

1. Use the newwin () function to create a window that will be added to the Panel.

2. Create a panel (using the created window) and press the panel into the stack according to the visible sequence specified by the user. Call

New_panel () function to create the panel.

3. Call the update_panels () function to write the panel to the virtual screen in the correct order and call the doupdate () function.

Data can be displayed on the panel.

4. show_panel (), hide_panel (), move_panel () and other functions are used to display, hide, and shift the Panel respectively.

You can use the panel_hidden () and panel_window () auxiliary functions when performing other operations. You can also

The user pointer is used to store panel data. The set_panel_userptr () and panel_userptr () functions use

To set and obtain the user pointer of a panel.

5. After a panel is used, use the del_panel () function to delete the panel.

The following is an example.

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;

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 ();

Getch ();

Endwin ();

}

All contents of the good AI Park blog is original, if reproduced please indicate the source http://blog.csdn.net/myhaspl/

Dp @ dp :~ /Cursestest % gcc-lncursesw-lpanel x. c-o mytest

Dp @ dp :~ /Cursestest %./mytest

Three windows are displayed on the screen. Each window is a panel, and each panel is associated with a window. As shown in:


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.