home *** CD-ROM | disk | FTP | other *** search
- /*tut_help.c -- displaying and scrolling a help file
-
- ************* (C) Copyright Vermont Creative Software 1985 ***************
-
- */
-
- #define HELPFILE "help.txt"
- #define HELPKEY -K_F1 /*"extended keys" return negative code*/
- #define EXIT -K_F10
- #define MAXCOL 76 /*window will have only 76 col for txt*/
- #define MAXLINES 200 /*the help file is < 200 lines */
-
- #define WN_DEBUG
- #include <wfc.h>
- #include <wfc_glob.h>
-
- main()
- {
- WINDOW hwn;
- MFILEPTR mfhelp; /*memory file for help file */
- int kc; /*key code */
-
- init_wfc(); /*initialize program */
- cls();
- mfhelp = mf_def(HELPFILE, MAXLINES, MAXCOL); /*init. file record */
- defs_wn(&hwn, 16, 0, 9, 80, BDR_LNP); /*define help window */
- sw_popup(ON, &hwn); /*make a pop-up window */
- sw_att(LHELP, &hwn); /*set attributes for help */
- sw_bdratt(LHELP, &hwn);
- sw_mf(mfhelp, &hwn); /*install pointer to mfhelp */
-
- v_st("Press key F1 to toggle help window\n" ,&wn0);
- v_st("When not in help window, press F10 to exit program.", &wn0);
- while((kc = ki()) != EXIT)
- {
- if(kc == HELPKEY) /*help requested */
- {
- if(! mf_rd(mfhelp)) /*read in help file */
- errout("error reading file ", HELPFILE);
- vs_mf(HELPKEY, &hwn); /*turn over to viewer */
- mf_clr(mfhelp);
- }
- }
- exit_wfc();
- return(0);
- }