NCURSES Programming HOWTO

Pradeep Padala

v1.9, 2005-06-20

Revision History
Revision 1.92005-06-20Revised by: ppadala
The license has been changed to the MIT-style license used by NCURSES. Note that the programs are also re-licensed under this.
Revision 1.82005-06-17Revised by: ppadala
Lots of updates. Added references and perl examples. Changes to examples. Many grammatical and stylistic changes to the content. Changes to NCURSES history.
Revision 1.7.12002-06-25Revised by: ppadala
Added a README file for building and instructions for building from source.
Revision 1.72002-06-25Revised by: ppadala
Added "Other formats" section and made a lot of fancy changes to the programs. Inlining of programs is gone.
Revision 1.6.12002-02-24Revised by: ppadala
Removed the old Changelog section, cleaned the makefiles
Revision 1.62002-02-16Revised by: ppadala
Corrected a lot of spelling mistakes, added ACS variables section
Revision 1.52002-01-05Revised by: ppadala
Changed structure to present proper TOC
Revision 1.3.12001-07-26Revised by: ppadala
Corrected maintainers paragraph, Corrected stable release number
Revision 1.32001-07-24Revised by: ppadala
Added copyright notices to main document (LDP license) and programs (GPL), Corrected printw_example.
Revision 1.22001-06-05Revised by: ppadala
Incorporated ravi's changes. Mainly to introduction, menu, form, justforfun sections
Revision 1.12001-05-22Revised by: ppadala
Added "a word about window" section, Added scanw_example.

This document is intended to be an "All in One" guide for programming with ncurses and its sister libraries. We graduate from a simple "Hello World" program to more complex form manipulation. No prior experience in ncurses is assumed. Send comments to this address


Table of Contents
1. Introduction
1.1. What is NCURSES?
1.2. What we can do with NCURSES
1.3. Where to get it
1.4. Purpose/Scope of the document
1.5. About the Programs
1.6. Other Formats of the document
1.7. Credits
1.8. Wish List
1.9. Copyright
2. Hello World !!!
2.1. Compiling With the NCURSES Library
2.2. Dissection
3. The Gory Details
4. Initialization
4.1. Initialization functions
4.2. raw() and cbreak()
4.3. echo() and noecho()
4.4. keypad()
4.5. halfdelay()
4.6. Miscellaneous Initialization functions
4.7. An Example
5. A Word about Windows
6. Output functions
6.1. addch() class of functions
6.2. mvaddch(), waddch() and mvwaddch()
6.3. printw() class of functions
6.4. addstr() class of functions
6.5. A word of caution
7. Input functions
7.1. getch() class of functions
7.2. scanw() class of functions
7.3. getstr() class of functions
7.4. Some examples
8. Attributes
8.1. The details
8.2. attron() vs attrset()
8.3. attr_get()
8.4. attr_ functions
8.5. wattr functions
8.6. chgat() functions
9. Windows
9.1. The basics
9.2. Let there be a Window !!!
9.3. Explanation
9.4. The other stuff in the example
9.5. Other Border functions
10. Colors
10.1. The basics
10.2. Changing Color Definitions
10.3. Color Content
11. Interfacing with the key board
11.1. The Basics
11.2. A Simple Key Usage example
12. Interfacing with the mouse
12.1. The Basics
12.2. Getting the events
12.3. Putting it all Together
12.4. Miscellaneous Functions
13. Screen Manipulation
13.1. getyx() functions
13.2. Screen Dumping
13.3. Window Dumping
14. Miscellaneous features
14.1. curs_set()
14.2. Temporarily Leaving Curses mode
14.3. ACS_ variables
15. Other libraries
16. Panel Library
16.1. The Basics
16.2. Compiling With the Panels Library
16.3. Panel Window Browsing
16.4. Using User Pointers
16.5. Moving and Resizing Panels
16.6. Hiding and Showing Panels
16.7. panel_above() and panel_below() Functions
17. Menus Library
17.1. The Basics
17.2. Compiling With the Menu Library
17.3. Menu Driver: The work horse of the menu system
17.4. Menu Windows
17.5. Scrolling Menus
17.6. Multi Columnar Menus
17.7. Multi Valued Menus
17.8. Menu Options
17.9. The useful User Pointer
18. Forms Library
18.1. The Basics
18.2. Compiling With the Forms Library
18.3. Playing with Fields
18.4. Form Windows
18.5. Field Validation
18.6. Form Driver: The work horse of the forms system
19. Tools and Widget Libraries
19.1. CDK (Curses Development Kit)
19.2. The dialog
19.3. Perl Curses Modules CURSES::FORM and CURSES::WIDGETS
20. Just For Fun !!!
20.1. The Game of Life
20.2. Magic Square
20.3. Towers of Hanoi
20.4. Queens Puzzle
20.5. Shuffle
20.6. Typing Tutor
21. References