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

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