home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / tug__002 / olddemo.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1988-08-08  |  6.1 KB  |  207 lines

  1. {TUG PDS CERT 1.01 (Pascal)
  2.  
  3. ==========================================================================
  4.  
  5.                   TUG PUBLIC DOMAIN SOFTWARE CERTIFICATION
  6.  
  7. The Turbo User Group (TUG) is recognized by Borland International as the
  8. official support organization for Turbo languages.  This file has been
  9. compiled and verified by the TUG library staff.  We are reasonably certain
  10. that the information contained in this file is public domain material, but
  11. it is also subject to any restrictions applied by its author.
  12.  
  13. This diskette contains PROGRAMS and/or DATA determined to be in the PUBLIC
  14. DOMAIN, provided as a service of TUG for the use of its members.  The
  15. Turbo User Group will not be liable for any damages, including any lost
  16. profits, lost savings or other incidental or consequential damages arising
  17. out of the use of or inability to use the contents, even if TUG has been
  18. advised of the possibility of such damages, or for any claim by any
  19. other party.
  20.  
  21. To the best of our knowledge, the routines in this file compile and function
  22. properly in accordance with the information described below.
  23.  
  24. If you discover an error in this file, we would appreciate it if you would
  25. report it to us.  To report bugs, or to request information on membership
  26. in TUG, please contact us at:
  27.  
  28.              Turbo User Group
  29.              PO Box 1510
  30.              Poulsbo, Washington USA  98370
  31.  
  32. --------------------------------------------------------------------------
  33.                        F i l e    I n f o r m a t i o n
  34.  
  35. * DESCRIPTION
  36. File used with FIELD.PAS.
  37.  
  38. * ASSOCIATED FILES
  39. FIELD.PAS
  40. FLDDEMO.PAS
  41. FLDTEST.PAS
  42. OLDDEMO.PAS
  43. FIELD.TXT
  44.  
  45. * CHECKED BY
  46. DRM 08/08/88
  47.  
  48. * KEYWORDS
  49. TURBO PASCAL V4.0
  50.  
  51. ==========================================================================
  52. }
  53. Program olddemo;
  54.  
  55. Uses Crt,Dos,field;
  56.  
  57. { This program illustrates the use of the field functions to generate
  58.   a screen display and to allow input.  It has no other purpose. }
  59.  
  60. Type linestring = String[80];
  61.  
  62. Var pickcount,titlenumber,fldnum,maxfldnum,keyreturn: Byte;
  63.     title1,items1,title2,items2,title3,items3: Byte;
  64.     pointer,marker: Char;
  65.     title,path,description: linestring;
  66.     picklist: Array[1..10] Of String[30];
  67.     paperlength: Integer;
  68.     rate,amount: Real;
  69.     justify,pitch,lines: Byte;
  70.  
  71. Procedure writepicklist(col,row,maxpick,titlenumber: Byte);
  72.  
  73. Begin
  74.   GotoXY(col,row);
  75.   Write(picklist[titlenumber]);
  76.   For pickcount:=1 To maxpick Do
  77.     Begin
  78.       GotoXY(col+1,row+pickcount);
  79.       Write(marker,' ',picklist[titlenumber+pickcount])
  80.     End;
  81. End;
  82.  
  83. Begin  { Demo program }
  84.   reversevideo:=False;
  85.   zerovoid:=True;
  86.   hitxtcolor:=Yellow;
  87.   lotxtcolor:=LightGray;
  88.   txtbkgnd:=Black;
  89.   pointer:=chr(pickpointer);
  90.   marker:=chr(pickmarker);
  91.   cursor(hidden);
  92.   TextMode(CO80);
  93.   TextColor(lotxtcolor);
  94.   TextBackground(txtbkgnd);
  95.   ClrScr;
  96.  
  97.   { Display headings and default values }
  98.   title:='Interactive Data Entry Demonstration';
  99.   GotoXY(39-(length(title) Div 2),2);Write(title);
  100.  
  101.   path:=''; description:='';
  102.   paperlength:=66;
  103.   rate:=0.0; amount:=0.0;
  104.   justify:=1; pitch:=1; lines:=1;
  105.   GotoXY(9,10); Write('Path: ');
  106.   GotoXY(2,11); Write('Description: ');
  107.   GotoXY(5,13); Write('Page (paper) Length:   ',paperlength:3);
  108.   GotoXY(16,14); Write('Amount: ',amount:7:2);
  109.   GotoXY(18,15); Write('Rate:   ',rate:5:3);
  110.  
  111.   { Define picklists }
  112.   picklist[1]:='Format';
  113.   picklist[2]:='Unjustified';
  114.   picklist[3]:='Justified';
  115.   title1:=1;
  116.   items1:=2;
  117.   picklist[4]:='Pitch';
  118.   picklist[5]:='10';
  119.   picklist[6]:='12';
  120.   picklist[7]:='16';
  121.   title2:=4;
  122.   items2:=3;
  123.   picklist[8]:='Lines/Inch';
  124.   picklist[9]:='Six';
  125.   picklist[10]:='Eight';
  126.   title3:=8;
  127.   items3:=2;
  128.  
  129.   { Write pick lists }
  130.   writepicklist(53,8,items1,title1);
  131.   writepicklist(53,12,items2,title2);
  132.   writepicklist(53,17,items3,title3);
  133.  
  134.   { Step through fields }
  135.   maxfldnum:=8;
  136.   fldnum:=1;
  137.   firstpass:=True;
  138.  
  139.   Repeat { Until screen accepted or canceled }
  140.  
  141.     Repeat { Until data entry or editing completed }
  142.  
  143.       { Execute the next field function }
  144.       Case fldnum Of
  145.         1: keyreturn:=editfield(15,10,30,0,caplet,optional,path);
  146.         2: keyreturn:=editfield(15,11,30,0,alsymb,manditory,description);
  147.         3: keyreturn:=editfield(28,13,3,0,usnint,optional,paperlength);
  148.         4: keyreturn:=editfield(24,14,7,2,sgndec,optional,amount);
  149.         5: keyreturn:=editfield(26,15,5,3,usndec,manditory,rate);
  150.         6: keyreturn:=getpick(53,9,items1,justify,picklist[title1+1]);
  151.         7: keyreturn:=getpick(53,13,items2,pitch,picklist[title2+1]);
  152.         8: keyreturn:=getpick(53,18,items3,lines,picklist[title3+1]);
  153.         Else
  154.       End;  { fldnum Case statement }
  155.  
  156.       { Select the next fldnum based on keyreturn }
  157.       Case keyreturn Of
  158.         enterkey:
  159.             If fldnum < maxfldnum
  160.             Then inc(fldnum)
  161.             Else fldnum:=0;
  162.         uparrowkey:
  163.             If fldnum > 1
  164.             Then dec(fldnum)
  165.             Else fldnum:=maxfldnum;
  166.         dnarrowkey:
  167.             If fldnum < maxfldnum
  168.             Then inc(fldnum)
  169.             Else fldnum:=1;
  170.         tabkey:
  171.             ; { no action }
  172.         shiftabkey:
  173.             ; { no action }
  174.         esckey:
  175.             If firstpass
  176.             Then Write(char(7))
  177.             Else fldnum:=0
  178.         Else
  179.       End;  { keyreturn Case statement}
  180.  
  181.     Until fldnum = 0; { Data entry or editing completed }
  182.  
  183.     note('END to Accept, ENTER to Edit, ESC to exit!');
  184.     Repeat
  185.       keyreturn:=getspecialkey;
  186.       If (keyreturn <> endkey) And
  187.          (keyreturn <> enterkey) And
  188.          (keyreturn <> esckey)
  189.       Then
  190.         errmsg('Must be END (Accept), ENTER (Edit), Or ESC (Exit)!');
  191.     Until
  192.          (keyreturn = enterkey) Or
  193.          (keyreturn = endkey) Or
  194.          (keyreturn = esckey);
  195.     If keyreturn = enterkey Then
  196.       Begin
  197.         firstpass:=false;
  198.         fldnum:=1
  199.       End;
  200.  
  201.   Until
  202.        (keyreturn = endkey) Or { Screen accepted }
  203.        (keyreturn = esckey);   { Screen cancled  }
  204.   cursor(underline); { cursor on }
  205.   NormVideo;
  206. End. { Demo }
  207.