home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / packer / arc / arctool / olddemo.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1988-09-29  |  4.5 KB  |  169 lines

  1. {                      F i l e    I n f o r m a t i o n
  2.  
  3. * DESCRIPTION
  4. File used with FIELD.PAS.
  5.  
  6. * ASSOCIATED FILES
  7. FIELD.PAS
  8. FLDDEMO.PAS
  9. FLDTEST.PAS
  10. OLDDEMO.PAS
  11. FIELD.TXT
  12.  
  13. }
  14. Program olddemo;
  15.  
  16. Uses Crt,Dos,field;
  17.  
  18. { This program illustrates the use of the field functions to generate
  19.   a screen display and to allow input.  It has no other purpose. }
  20.  
  21. Type linestring = String[80];
  22.  
  23. Var pickcount,titlenumber,fldnum,maxfldnum,keyreturn: Byte;
  24.     title1,items1,title2,items2,title3,items3: Byte;
  25.     pointer,marker: Char;
  26.     title,path,description: linestring;
  27.     picklist: Array[1..10] Of String[30];
  28.     paperlength: Integer;
  29.     rate,amount: Real;
  30.     justify,pitch,lines: Byte;
  31.  
  32. Procedure writepicklist(col,row,maxpick,titlenumber: Byte);
  33.  
  34. Begin
  35.   GotoXY(col,row);
  36.   Write(picklist[titlenumber]);
  37.   For pickcount:=1 To maxpick Do
  38.     Begin
  39.       GotoXY(col+1,row+pickcount);
  40.       Write(marker,' ',picklist[titlenumber+pickcount])
  41.     End;
  42. End;
  43.  
  44. Begin  { Demo program }
  45.   reversevideo:=False;
  46.   zerovoid:=True;
  47.   hitxtcolor:=Yellow;
  48.   lotxtcolor:=LightGray;
  49.   txtbkgnd:=Black;
  50.   pointer:=chr(pickpointer);
  51.   marker:=chr(pickmarker);
  52.   cursor(hidden);
  53.   TextMode(CO80);
  54.   TextColor(lotxtcolor);
  55.   TextBackground(txtbkgnd);
  56.   ClrScr;
  57.  
  58.   { Display headings and default values }
  59.   title:='Interactive Data Entry Demonstration';
  60.   GotoXY(39-(length(title) Div 2),2);Write(title);
  61.  
  62.   path:=''; description:='';
  63.   paperlength:=66;
  64.   rate:=0.0; amount:=0.0;
  65.   justify:=1; pitch:=1; lines:=1;
  66.   GotoXY(9,10); Write('Path: ');
  67.   GotoXY(2,11); Write('Description: ');
  68.   GotoXY(5,13); Write('Page (paper) Length:   ',paperlength:3);
  69.   GotoXY(16,14); Write('Amount: ',amount:7:2);
  70.   GotoXY(18,15); Write('Rate:   ',rate:5:3);
  71.  
  72.   { Define picklists }
  73.   picklist[1]:='Format';
  74.   picklist[2]:='Unjustified';
  75.   picklist[3]:='Justified';
  76.   title1:=1;
  77.   items1:=2;
  78.   picklist[4]:='Pitch';
  79.   picklist[5]:='10';
  80.   picklist[6]:='12';
  81.   picklist[7]:='16';
  82.   title2:=4;
  83.   items2:=3;
  84.   picklist[8]:='Lines/Inch';
  85.   picklist[9]:='Six';
  86.   picklist[10]:='Eight';
  87.   title3:=8;
  88.   items3:=2;
  89.  
  90.   { Write pick lists }
  91.   writepicklist(53,8,items1,title1);
  92.   writepicklist(53,12,items2,title2);
  93.   writepicklist(53,17,items3,title3);
  94.  
  95.   { Step through fields }
  96.   maxfldnum:=8;
  97.   fldnum:=1;
  98.   firstpass:=True;
  99.  
  100.   Repeat { Until screen accepted or canceled }
  101.  
  102.     Repeat { Until data entry or editing completed }
  103.  
  104.       { Execute the next field function }
  105.       Case fldnum Of
  106.         1: keyreturn:=editfield(15,10,30,0,caplet,optional,path);
  107.         2: keyreturn:=editfield(15,11,30,0,alsymb,manditory,description);
  108.         3: keyreturn:=editfield(28,13,3,0,usnint,optional,paperlength);
  109.         4: keyreturn:=editfield(24,14,7,2,sgndec,optional,amount);
  110.         5: keyreturn:=editfield(26,15,5,3,usndec,manditory,rate);
  111.         6: keyreturn:=getpick(53,9,items1,justify,picklist[title1+1]);
  112.         7: keyreturn:=getpick(53,13,items2,pitch,picklist[title2+1]);
  113.         8: keyreturn:=getpick(53,18,items3,lines,picklist[title3+1]);
  114.         Else
  115.       End;  { fldnum Case statement }
  116.  
  117.       { Select the next fldnum based on keyreturn }
  118.       Case keyreturn Of
  119.         enterkey:
  120.             If fldnum < maxfldnum
  121.             Then inc(fldnum)
  122.             Else fldnum:=0;
  123.         uparrowkey:
  124.             If fldnum > 1
  125.             Then dec(fldnum)
  126.             Else fldnum:=maxfldnum;
  127.         dnarrowkey:
  128.             If fldnum < maxfldnum
  129.             Then inc(fldnum)
  130.             Else fldnum:=1;
  131.         tabkey:
  132.             ; { no action }
  133.         shiftabkey:
  134.             ; { no action }
  135.         esckey:
  136.             If firstpass
  137.             Then Write(char(7))
  138.             Else fldnum:=0
  139.         Else
  140.       End;  { keyreturn Case statement}
  141.  
  142.     Until fldnum = 0; { Data entry or editing completed }
  143.  
  144.     note('END to Accept, ENTER to Edit, ESC to exit!');
  145.     Repeat
  146.       keyreturn:=getspecialkey;
  147.       If (keyreturn <> endkey) And
  148.          (keyreturn <> enterkey) And
  149.          (keyreturn <> esckey)
  150.       Then
  151.         errmsg('Must be END (Accept), ENTER (Edit), Or ESC (Exit)!');
  152.     Until
  153.          (keyreturn = enterkey) Or
  154.          (keyreturn = endkey) Or
  155.          (keyreturn = esckey);
  156.     If keyreturn = enterkey Then
  157.       Begin
  158.         firstpass:=false;
  159.         fldnum:=1
  160.       End;
  161.  
  162.   Until
  163.        (keyreturn = endkey) Or { Screen accepted }
  164.        (keyreturn = esckey);   { Screen cancled  }
  165.   cursor(underline); { cursor on }
  166.   NormVideo;
  167. End. { Demo }
  168. 
  169.