NCURSES Programming HOWTO

Pradeep Padala

p_padala@yahoo.com

v1.5, 2002-01-05

Revision History
Revision 1.5 2002-01-05 Revised by: ppadala
Changed structure to present proper TOC

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. Latest version of the document can always be found at my web site. Send comments to


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. Credits
1.7. Wish List
1.8. Change Log
1.9. Copyright
2. The Hello World Program
2.1. Compiling With the Ncurses Library
2.2. Dissection
3. The Gory Details
4. Initialization
4.1. About Initialization functions like raw() etc...
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. About output functions like printw()
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. About input functions like scanw()
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. All about window functions
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. All about color
10.1. The basics
10.2. Changing Color Definitions
10.3. Color Content
11. Key management. How to read function keys, arrow keys etc..
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
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