home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / CPROG / FORMGE.ZIP / STEST.C < prev    next >
Text File  |  1989-04-20  |  3KB  |  107 lines

  1. /*----------------------------------------------------------------------*/
  2. /* 
  3.   Variables used: 
  4.     int      myint;
  5.     char     mychar;
  6.     float     myfloat;
  7.     char     mystring[25+1];
  8. */
  9. /*----------------------------------------------------------------------*/
  10.  
  11. void displayme(void)
  12. /* screen code generated by formgen using: stest */
  13. {
  14.     bfore = YELLOW; textcolor(YELLOW);
  15.     bback = BLACK; textbackground(BLACK);
  16.     /* change next line from bclear() to savescreen() if you */
  17.     /* want the form to pop up over existing background      */
  18.     bclear(0);
  19.     bfore = WHITE; textcolor(WHITE);
  20.     bback = BLUE; textbackground(BLUE);
  21.     bwrite(0,20,4,"╔═══════════════════════════════════════╗");
  22.     bwrite(0,20,5,"║ Integer:                              ║");
  23.     bwrite(0,20,6,"║ Char:                                 ║");
  24.     bwrite(0,20,7,"║ Float:                                ║");
  25.     bwrite(0,20,8,"║ String:                               ║");
  26.     bwrite(0,20,9,"║                                       ║");
  27.     bwrite(0,20,10,"║ This (short) version excludes the     ║");
  28.     bwrite(0,20,11,"║ editor-in-a-box to illustrate how     ║");
  29.     bwrite(0,20,12,"║ much space you can save by not having ║");
  30.     bwrite(0,20,13,"║ to link in the ioed module.           ║");
  31.     bwrite(0,20,14,"╚═══════════════════════════════════════╝");
  32.     bfore = YELLOW; textcolor(YELLOW);
  33.     bback = BLACK; textbackground(BLACK);
  34.     restorescreen(0);
  35. }
  36.  
  37. /*----------------------------------------------------------------------*/
  38.  
  39. void fillme()
  40. {
  41.     bfore = BLUE; textcolor(BLUE);
  42.     bback = LIGHTGRAY; textbackground(LIGHTGRAY);
  43.     gotoxy(32,5); cprintf("%6d",myint);
  44.     gotoxy(32,6); cprintf("%c",mychar);
  45.     gotoxy(32,7); cprintf("%6.2d",myfloat);
  46.     gotoxy(32,8); cprintf("%-25s",mystring);
  47.  
  48.     bfore = YELLOW; textcolor(YELLOW);
  49.     bback = BLACK; textbackground(BLACK);
  50. }
  51.  
  52. /*----------------------------------------------------------------------*/
  53.  
  54. void editme()
  55. {
  56.     int    rcode,fieldnumber,col,xp,yp;
  57.  
  58.     bfore = BLUE; textcolor(BLUE);
  59.     bback = LIGHTGRAY; textbackground(LIGHTGRAY);
  60.     fieldnumber = 0;
  61.     do {
  62.         col = xp = yp = rcode = 0;
  63.         switch (fieldnumber) {
  64.           case 0:
  65.             rcode = getint(32,5,&myint,6);
  66.             break;
  67.           case 1:
  68.             rcode = getachar(32,6,&mychar);
  69.             break;
  70.           case 2:
  71.             rcode = getfloat(32,7,&myfloat,6,2);
  72.             break;
  73.           case 3:
  74.             rcode = getstring(32,8,&col,mystring,25);
  75.             break;
  76.         }  /* switch fieldnumber */
  77.  
  78.         switch (rcode) {
  79.             case 0:
  80.             case 1:
  81.             case 5:
  82.             case 6:
  83.             case 10:
  84.                 fieldnumber++;
  85.                 break;
  86.             case 3:
  87.             case 4:
  88.             case 9:
  89.                 fieldnumber--;
  90.                 break;
  91.             case 2:
  92.             case 7:
  93.             case 8:
  94.                 rcode = 8; /* exit loop */
  95.                 break;
  96.         }  /* switch rcode */
  97.  
  98.         if (fieldnumber<0) fieldnumber = 3;
  99.         if (fieldnumber>3) fieldnumber = 0;
  100.     } while (rcode != 8);
  101.     bfore = YELLOW; textcolor(YELLOW);
  102.     bback = BLACK; textbackground(BLACK);
  103.     /* insert any special instructions here */
  104.  
  105. }
  106.  
  107.