<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML ><HEAD ><TITLE > NCURSES Programming HOWTO </TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="NEXT" TITLE="Introduction" HREF="intro.html"></HEAD ><BODY CLASS="ARTICLE" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="ARTICLE" ><DIV CLASS="TITLEPAGE" ><H1 CLASS="TITLE" ><A NAME="AEN2" ></A >NCURSES Programming HOWTO</H1 ><H3 CLASS="AUTHOR" ><A NAME="AEN4" > Pradeep Padala </A ></H3 ><DIV CLASS="AFFILIATION" ><DIV CLASS="ADDRESS" ><P CLASS="ADDRESS" ><TT CLASS="EMAIL" ><<A HREF="mailto:ppadala@gmail.com" >ppadala@gmail.com</A >></TT ></P ></DIV ></DIV ><P CLASS="PUBDATE" >v1.9, 2005-06-20<BR></P ><DIV CLASS="REVHISTORY" ><TABLE WIDTH="100%" BORDER="0" ><TR ><TH ALIGN="LEFT" VALIGN="TOP" COLSPAN="3" ><B >Revision History</B ></TH ></TR ><TR ><TD ALIGN="LEFT" >Revision 1.9</TD ><TD ALIGN="LEFT" >2005-06-20</TD ><TD ALIGN="LEFT" >Revised by: ppadala</TD ></TR ><TR ><TD ALIGN="LEFT" COLSPAN="3" >The license has been changed to the MIT-style license used by NCURSES. Note that the programs are also re-licensed under this.</TD ></TR ><TR ><TD ALIGN="LEFT" >Revision 1.8</TD ><TD ALIGN="LEFT" >2005-06-17</TD ><TD ALIGN="LEFT" >Revised by: ppadala</TD ></TR ><TR ><TD ALIGN="LEFT" COLSPAN="3" >Lots of updates. Added references and perl examples. Changes to examples. Many grammatical and stylistic changes to the content. Changes to NCURSES history.</TD ></TR ><TR ><TD ALIGN="LEFT" >Revision 1.7.1</TD ><TD ALIGN="LEFT" >2002-06-25</TD ><TD ALIGN="LEFT" >Revised by: ppadala</TD ></TR ><TR ><TD ALIGN="LEFT" COLSPAN="3" >Added a README file for building and instructions for building from source.</TD ></TR ><TR ><TD ALIGN="LEFT" >Revision 1.7</TD ><TD ALIGN="LEFT" >2002-06-25</TD ><TD ALIGN="LEFT" >Revised by: ppadala</TD ></TR ><TR ><TD ALIGN="LEFT" COLSPAN="3" >Added "Other formats" section and made a lot of fancy changes to the programs. Inlining of programs is gone.</TD ></TR ><TR ><TD ALIGN="LEFT" >Revision 1.6.1</TD ><TD ALIGN="LEFT" >2002-02-24</TD ><TD ALIGN="LEFT" >Revised by: ppadala</TD ></TR ><TR ><TD ALIGN="LEFT" COLSPAN="3" >Removed the old Changelog section, cleaned the makefiles</TD ></TR ><TR ><TD ALIGN="LEFT" >Revision 1.6</TD ><TD ALIGN="LEFT" >2002-02-16</TD ><TD ALIGN="LEFT" >Revised by: ppadala</TD ></TR ><TR ><TD ALIGN="LEFT" COLSPAN="3" >Corrected a lot of spelling mistakes, added ACS variables section</TD ></TR ><TR ><TD ALIGN="LEFT" >Revision 1.5</TD ><TD ALIGN="LEFT" >2002-01-05</TD ><TD ALIGN="LEFT" >Revised by: ppadala</TD ></TR ><TR ><TD ALIGN="LEFT" COLSPAN="3" >Changed structure to present proper TOC</TD ></TR ><TR ><TD ALIGN="LEFT" >Revision 1.3.1</TD ><TD ALIGN="LEFT" >2001-07-26</TD ><TD ALIGN="LEFT" >Revised by: ppadala</TD ></TR ><TR ><TD ALIGN="LEFT" COLSPAN="3" >Corrected maintainers paragraph, Corrected stable release number</TD ></TR ><TR ><TD ALIGN="LEFT" >Revision 1.3</TD ><TD ALIGN="LEFT" >2001-07-24</TD ><TD ALIGN="LEFT" >Revised by: ppadala</TD ></TR ><TR ><TD ALIGN="LEFT" COLSPAN="3" >Added copyright notices to main document (LDP license) and programs (GPL), Corrected printw_example.</TD ></TR ><TR ><TD ALIGN="LEFT" >Revision 1.2</TD ><TD ALIGN="LEFT" >2001-06-05</TD ><TD ALIGN="LEFT" >Revised by: ppadala</TD ></TR ><TR ><TD ALIGN="LEFT" COLSPAN="3" >Incorporated ravi's changes. Mainly to introduction, menu, form, justforfun sections</TD ></TR ><TR ><TD ALIGN="LEFT" >Revision 1.1</TD ><TD ALIGN="LEFT" >2001-05-22</TD ><TD ALIGN="LEFT" >Revised by: ppadala</TD ></TR ><TR ><TD ALIGN="LEFT" COLSPAN="3" >Added "a word about window" section, Added scanw_example.</TD ></TR ></TABLE ></DIV ><DIV ><DIV CLASS="ABSTRACT" ><A NAME="AEN67" ></A ><P ></P ><P > <EM >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 <A HREF="mailto:ppadala@gmail.com" TARGET="_top" >this address</A > </EM > </P ><P ></P ></DIV ></DIV ><HR></DIV ><DIV CLASS="TOC" ><DL ><DT ><B >Table of Contents</B ></DT ><DT >1. <A HREF="intro.html" >Introduction</A ></DT ><DD ><DL ><DT >1.1. <A HREF="intro.html#WHATIS" >What is NCURSES?</A ></DT ><DT >1.2. <A HREF="intro.html#WHATCANWEDO" >What we can do with NCURSES</A ></DT ><DT >1.3. <A HREF="intro.html#WHERETOGETIT" >Where to get it</A ></DT ><DT >1.4. <A HREF="intro.html#PURPOSE" >Purpose/Scope of the document</A ></DT ><DT >1.5. <A HREF="intro.html#ABOUTPROGRAMS" >About the Programs</A ></DT ><DT >1.6. <A HREF="intro.html#OTHERFORMATS" >Other Formats of the document</A ></DT ><DT >1.7. <A HREF="intro.html#CREDITS" >Credits</A ></DT ><DT >1.8. <A HREF="intro.html#WISHLIST" >Wish List</A ></DT ><DT >1.9. <A HREF="intro.html#COPYRIGHT" >Copyright</A ></DT ></DL ></DD ><DT >2. <A HREF="helloworld.html" >Hello World !!!</A ></DT ><DD ><DL ><DT >2.1. <A HREF="helloworld.html#COMPILECURSES" >Compiling With the NCURSES Library</A ></DT ><DT >2.2. <A HREF="helloworld.html#DISSECTION" >Dissection</A ></DT ></DL ></DD ><DT >3. <A HREF="gory.html" >The Gory Details</A ></DT ><DT >4. <A HREF="init.html" >Initialization</A ></DT ><DD ><DL ><DT >4.1. <A HREF="init.html#ABOUTINIT" >Initialization functions</A ></DT ><DT >4.2. <A HREF="init.html#RAWCBREAK" >raw() and cbreak()</A ></DT ><DT >4.3. <A HREF="init.html#ECHONOECHO" >echo() and noecho()</A ></DT ><DT >4.4. <A HREF="init.html#KEYPAD" >keypad()</A ></DT ><DT >4.5. <A HREF="init.html#HALFDELAY" >halfdelay()</A ></DT ><DT >4.6. <A HREF="init.html#MISCINIT" >Miscellaneous Initialization functions</A ></DT ><DT >4.7. <A HREF="init.html#INITEX" >An Example</A ></DT ></DL ></DD ><DT >5. <A HREF="awordwindows.html" >A Word about Windows</A ></DT ><DT >6. <A HREF="printw.html" >Output functions</A ></DT ><DD ><DL ><DT >6.1. <A HREF="printw.html#ADDCHCLASS" >addch() class of functions</A ></DT ><DT >6.2. <A HREF="printw.html#AEN298" >mvaddch(), waddch() and mvwaddch()</A ></DT ><DT >6.3. <A HREF="printw.html#PRINTWCLASS" >printw() class of functions</A ></DT ><DT >6.4. <A HREF="printw.html#ADDSTRCLASS" >addstr() class of functions</A ></DT ><DT >6.5. <A HREF="printw.html#ACAUTION" >A word of caution</A ></DT ></DL ></DD ><DT >7. <A HREF="scanw.html" >Input functions</A ></DT ><DD ><DL ><DT >7.1. <A HREF="scanw.html#GETCHCLASS" >getch() class of functions</A ></DT ><DT >7.2. <A HREF="scanw.html#SCANWCLASS" >scanw() class of functions</A ></DT ><DT >7.3. <A HREF="scanw.html#GETSTRCLASS" >getstr() class of functions</A ></DT ><DT >7.4. <A HREF="scanw.html#GETSTREX" >Some examples</A ></DT ></DL ></DD ><DT >8. <A HREF="attrib.html" >Attributes</A ></DT ><DD ><DL ><DT >8.1. <A HREF="attrib.html#ATTRIBDETAILS" >The details</A ></DT ><DT >8.2. <A HREF="attrib.html#ATTRONVSATTRSET" >attron() vs attrset()</A ></DT ><DT >8.3. <A HREF="attrib.html#ATTR_GET" >attr_get()</A ></DT ><DT >8.4. <A HREF="attrib.html#ATTR_FUNCS" >attr_ functions</A ></DT ><DT >8.5. <A HREF="attrib.html#WATTRFUNCS" >wattr functions</A ></DT ><DT >8.6. <A HREF="attrib.html#CHGAT" >chgat() functions</A ></DT ></DL ></DD ><DT >9. <A HREF="windows.html" >Windows</A ></DT ><DD ><DL ><DT >9.1. <A HREF="windows.html#WINDOWBASICS" >The basics</A ></DT ><DT >9.2. <A HREF="windows.html#LETBEWINDOW" >Let there be a Window !!!</A ></DT ><DT >9.3. <A HREF="windows.html#BORDEREXEXPL" >Explanation</A ></DT ><DT >9.4. <A HREF="windows.html#OTHERSTUFF" >The other stuff in the example</A ></DT ><DT >9.5. <A HREF="windows.html#OTHERBORDERFUNCS" >Other Border functions</A ></DT ></DL ></DD ><DT >10. <A HREF="color.html" >Colors</A ></DT ><DD ><DL ><DT >10.1. <A HREF="color.html#COLORBASICS" >The basics</A ></DT ><DT >10.2. <A HREF="color.html#CHANGECOLORDEFS" >Changing Color Definitions</A ></DT ><DT >10.3. <A HREF="color.html#COLORCONTENT" >Color Content</A ></DT ></DL ></DD ><DT >11. <A HREF="keys.html" >Interfacing with the key board</A ></DT ><DD ><DL ><DT >11.1. <A HREF="keys.html#KEYSBASICS" >The Basics</A ></DT ><DT >11.2. <A HREF="keys.html#SIMPLEKEYEX" >A Simple Key Usage example</A ></DT ></DL ></DD ><DT >12. <A HREF="mouse.html" >Interfacing with the mouse</A ></DT ><DD ><DL ><DT >12.1. <A HREF="mouse.html#MOUSEBASICS" >The Basics</A ></DT ><DT >12.2. <A HREF="mouse.html#GETTINGEVENTS" >Getting the events</A ></DT ><DT >12.3. <A HREF="mouse.html#MOUSETOGETHER" >Putting it all Together</A ></DT ><DT >12.4. <A HREF="mouse.html#MISCMOUSEFUNCS" >Miscellaneous Functions</A ></DT ></DL ></DD ><DT >13. <A HREF="screen.html" >Screen Manipulation</A ></DT ><DD ><DL ><DT >13.1. <A HREF="screen.html#GETYX" >getyx() functions</A ></DT ><DT >13.2. <A HREF="screen.html#SCREENDUMP" >Screen Dumping</A ></DT ><DT >13.3. <A HREF="screen.html#WINDOWDUMP" >Window Dumping</A ></DT ></DL ></DD ><DT >14. <A HREF="misc.html" >Miscellaneous features</A ></DT ><DD ><DL ><DT >14.1. <A HREF="misc.html#CURSSET" >curs_set()</A ></DT ><DT >14.2. <A HREF="misc.html#TEMPLEAVE" >Temporarily Leaving Curses mode</A ></DT ><DT >14.3. <A HREF="misc.html#ACSVARS" >ACS_ variables</A ></DT ></DL ></DD ><DT >15. <A HREF="otherlib.html" >Other libraries</A ></DT ><DT >16. <A HREF="panels.html" >Panel Library</A ></DT ><DD ><DL ><DT >16.1. <A HREF="panels.html#PANELBASICS" >The Basics</A ></DT ><DT >16.2. <A HREF="panels.html#COMPILEPANELS" >Compiling With the Panels Library</A ></DT ><DT >16.3. <A HREF="panels.html#PANELBROWSING" >Panel Window Browsing</A ></DT ><DT >16.4. <A HREF="panels.html#USERPTRUSING" >Using User Pointers</A ></DT ><DT >16.5. <A HREF="panels.html#PANELMOVERESIZE" >Moving and Resizing Panels</A ></DT ><DT >16.6. <A HREF="panels.html#PANELSHOWHIDE" >Hiding and Showing Panels</A ></DT ><DT >16.7. <A HREF="panels.html#PANELABOVE" >panel_above() and panel_below() Functions</A ></DT ></DL ></DD ><DT >17. <A HREF="menus.html" >Menus Library</A ></DT ><DD ><DL ><DT >17.1. <A HREF="menus.html#MENUBASICS" >The Basics</A ></DT ><DT >17.2. <A HREF="menus.html#COMPILEMENUS" >Compiling With the Menu Library</A ></DT ><DT >17.3. <A HREF="menus.html#MENUDRIVER" >Menu Driver: The work horse of the menu system</A ></DT ><DT >17.4. <A HREF="menus.html#MENUWINDOWS" >Menu Windows</A ></DT ><DT >17.5. <A HREF="menus.html#SCROLLMENUS" >Scrolling Menus</A ></DT ><DT >17.6. <A HREF="menus.html#MULTICOLUMN" >Multi Columnar Menus</A ></DT ><DT >17.7. <A HREF="menus.html#MULTIVALUEMENUS" >Multi Valued Menus</A ></DT ><DT >17.8. <A HREF="menus.html#MENUOPT" >Menu Options</A ></DT ><DT >17.9. <A HREF="menus.html#MENUUSERPTR" >The useful User Pointer</A ></DT ></DL ></DD ><DT >18. <A HREF="forms.html" >Forms Library</A ></DT ><DD ><DL ><DT >18.1. <A HREF="forms.html#FORMBASICS" >The Basics</A ></DT ><DT >18.2. <A HREF="forms.html#COMPILEFORMS" >Compiling With the Forms Library</A ></DT ><DT >18.3. <A HREF="forms.html#PLAYFIELDS" >Playing with Fields</A ></DT ><DT >18.4. <A HREF="forms.html#FORMWINDOWS" >Form Windows</A ></DT ><DT >18.5. <A HREF="forms.html#FILEDVALIDATE" >Field Validation</A ></DT ><DT >18.6. <A HREF="forms.html#FORMDRIVER" >Form Driver: The work horse of the forms system</A ></DT ></DL ></DD ><DT >19. <A HREF="tools.html" >Tools and Widget Libraries</A ></DT ><DD ><DL ><DT >19.1. <A HREF="tools.html#CDK" >CDK (Curses Development Kit)</A ></DT ><DT >19.2. <A HREF="tools.html#DIALOG" >The dialog</A ></DT ><DT >19.3. <A HREF="tools.html#PERLCURSES" >Perl Curses Modules CURSES::FORM and CURSES::WIDGETS</A ></DT ></DL ></DD ><DT >20. <A HREF="justforfun.html" >Just For Fun !!!</A ></DT ><DD ><DL ><DT >20.1. <A HREF="justforfun.html#GAMEOFLIFE" >The Game of Life</A ></DT ><DT >20.2. <A HREF="justforfun.html#MAGIC" >Magic Square</A ></DT ><DT >20.3. <A HREF="justforfun.html#HANOI" >Towers of Hanoi</A ></DT ><DT >20.4. <A HREF="justforfun.html#QUEENS" >Queens Puzzle</A ></DT ><DT >20.5. <A HREF="justforfun.html#SHUFFLE" >Shuffle</A ></DT ><DT >20.6. <A HREF="justforfun.html#TT" >Typing Tutor</A ></DT ></DL ></DD ><DT >21. <A HREF="ref.html" >References</A ></DT ></DL ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" > </TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" > </TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="intro.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" > </TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" > </TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Introduction</TD ></TR ></TABLE ></DIV ></BODY ></HTML >