home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Interactive Guide / c-cplusplus-interactive-guide.iso / c_ref / csource4 / 291_01 / jjbshow2.c < prev    next >
Text File  |  1989-06-28  |  9KB  |  167 lines

  1. /***************************************************************************
  2.  *                                                                         *
  3.  *                           JJBSHOW2.C                                    *
  4.  *                                                                         *
  5.  *   Copyright (c) 1988, 1989, JJB. All rights reserved.                   *
  6.  *                                                                         *
  7.  *   This example shows you how to assign functions to options.            *
  8.  *                                                                         *
  9.  *                                                                         *
  10.  *                   'funct(functionname)'                                 *
  11.  *                                                                         *
  12.  *                                                                         *
  13.  *   Just glance and it and move on to example JJBSHOW3.C                  *
  14.  *                                                                         *
  15.  *   Turbo C is a trademark of Borland International, Inc.                 *
  16.  *   Quick C is a trademark of Microsoft Corp.                             *
  17.  *   JJB, 9236 church Rd suite 1082, Dallas, Tx 75231 (214) 341-1635       *
  18.  ***************************************************************************/
  19.  
  20.  
  21. /***************************************************************************
  22.  * For Turbo C programmers only:                                           *
  23.  *   To run this program from DOS:                                         *
  24.  *                                                                         *
  25.  *         Enter 'TC JJBSHOW2'    ( to load this file with Turbo C)        *
  26.  *         Press 'CTRL F9'        ( to compile and begin executing)        *
  27.  *                                                                         *
  28.  ***************************************************************************/
  29.  
  30. /***************************************************************************
  31.  * for Quick C programmers only:                                           *
  32.  *   To run this program, from DOS:                                        *
  33.  *                                                                         *
  34.  *         Enter 'JJBQCS2'    ( to load this file with JJB.QLB)            *
  35.  *         Press 'F5'         ( to compile and begin executing)            *
  36.  *                                                                         *
  37.  *   To make the .exe file JJBSHOW2.EXE, from DOS enter:                   *
  38.  *         QCL  /c  /AM  JJBSHOW2.C                                        *
  39.  *         LINK  JJBSHOW2.OBJ + JJBQC.OBJ,,, C:LIB\,                       *
  40.  *                                                                         *
  41.  ***************************************************************************/
  42.  
  43. /***************************************************************************
  44.  *                                                                         *
  45.  * for both TURBO C and QUICK C programmers:                               *
  46.  *                                                                         *
  47.  * Not all options have been assigned functions. The options unassigned    *
  48.  * execute the JJB copyright function.                                     *
  49.  *                                                                         *
  50.  * As JJB executes (runs) a program, the following keys can be pressed:    *
  51.  *                                                                         *
  52.  *    ALT X     to exit.                                                   *
  53.  *    F1        to display a help screen.                                  *
  54.  *    F2-F9     to instantly select another option.                        *
  55.  *    ALT       to select a group of options.                              *
  56.  *    ALT       and a letter to select a specific group.                   *
  57.  *    ESC       means nevermind.                                           *
  58.  *       ->        to select the group to the right.                       *
  59.  *       <-        to select the group to the left.                        *
  60.  *       UPARROW   to highlight the option above.                          *
  61.  *       DOWNARROW to highlight the option below.                          *
  62.  *       RETURN    to select the option highlighted.                       *
  63.  *       A LETTER  to select a specific option.                            *
  64.  *       ALT and a letter to select a different group.                     *
  65.  *       ESC       return exactly where you were in the function           *
  66.  *                      currently being executed.                          *
  67.  *                                                                         *
  68.  * If another option is selected, JJB will execute:                        *
  69.  *                                                                         *
  70.  *         the leave function for the current option.                      *
  71.  *         the leave function for the current group.                       *
  72.  *         the initalization function for the selected group.              *
  73.  *         the initalization function for the selected option.             *
  74.  *         and option function.                                            *
  75.  *                                                                         *
  76.  ***************************************************************************/
  77.  
  78. /* see JJB-READ.DOC for an additional explanation of the functions below.  */
  79.  
  80. #include <jjbset.h>
  81.  
  82. main()
  83.   {
  84.   jjb_initalize();        /* initalizes JJB   */
  85.   jjb_setup();            /* setup options & assign functions     */
  86.   jjb_start();            /* start executing the default option   */
  87.  
  88.   }
  89.  
  90.  
  91.  
  92. /***************************************************************************
  93.  *                        SAMPLE HELP FUNCTION                             *
  94.  ***************************************************************************/
  95.  
  96. /* 'vfwc' puts out a window centered on the screen.                    */
  97. vfwc(width,depth) int width,depth; { int row,col;
  98.     row = (25 - depth) / 2;   /* compute row for making the window  */
  99.     col = (80 - width) / 2;   /* compute col for making the window  */
  100.     vfw(row,col,width,depth); /* now make the window                */
  101.     }
  102.  
  103. my_help() {
  104.      vsave_screen();
  105.      set_color(RED ONBLUE);
  106.      vfwc(38,7);                 /*  'vf' a window centered   */
  107.      vfsdo(" ",SAME);
  108.      vfsdo("This example shows you how to",SAME);
  109.      vfsdo("assign a function to an option.",SAME);
  110.      vfsdo(" ",SAME);
  111.      vfsdo("Now move on to next show example.",SAME);
  112.      vfsdo(" ",SAME);
  113.      bright();
  114.      vfsc("Press any key "); getch();
  115.      normal();
  116.      vrest_screen();
  117.   }
  118.  
  119. /* The function below uses some of the functions in the JJB library.*/
  120.  
  121. video_message() {
  122.   vclrw();         /* clear the window */
  123.   vloc(10,20);     /* position the video fast cursor */
  124.   vfsc("This message will appear on the screen.");
  125.   get_ch();
  126. }
  127.  
  128.  
  129.  
  130. /****************************************************************************
  131.  *                                                                          *
  132.  *                       jjb_setup()                                        *
  133.  *                                                                          *
  134.  *   jjb_setup() is where you should define how your pull down menus will   *
  135.  *   for each group and option of the group.                                *
  136.  *                                                                          *
  137.  *   This example shows you how to assign function names to options.        *
  138.  *                                                                          *
  139.  ****************************************************************************/
  140.  
  141.  
  142. jjb_setup() {
  143.  
  144.   group("Update");
  145.      option("Video a message on the screen");
  146.         funct(video_message);
  147.      option("Update