home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / io / inputs / example.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1988-06-02  |  2.9 KB  |  147 lines

  1. Program Example;
  2. {$V-}  {Neccessary to use these units}
  3. uses dos,crt,general,inputs;
  4.  
  5. var
  6.   date1 : String[8];
  7.   FirstName : String[15];
  8.   LastName:   String[15];
  9.   Amountpaid : String[7];
  10.   LatePayment : boolean;
  11.   outcode : integer;
  12.  
  13. procedure setitup;
  14.  
  15.    {This procedure sets up the input array}
  16.  
  17. begin
  18.   color(15,1,false,false,false);
  19.   with input[1] do
  20.     begin
  21.       x := 35;
  22.       y := 8;
  23.       len := 15;
  24.       up := 1;
  25.       down := 2;
  26.       typeof := 'A';
  27.       Decimal := 0;
  28.       filler := '@'
  29.     end;
  30.   with input[2] do
  31.     begin
  32.       x := 55;
  33.       y := 8;
  34.       len := 15;
  35.       up := 1;
  36.       down := 3;
  37.       typeof := 'A';
  38.       Decimal := 0;
  39.       filler := '@'
  40.     end;
  41.   with input[3] do
  42.     begin
  43.       x := 35;
  44.       y := 10;
  45.       len := 8;
  46.       up := 2;
  47.       down := 4;
  48.       typeof := 'D';
  49.       Decimal := 0;
  50.       filler := '@'
  51.     end;
  52.   with input[4] do
  53.     begin
  54.       x := 35;
  55.       y := 12;
  56.       len := 7;
  57.       up := 3;
  58.       down := 5;
  59.       typeof := 'N';
  60.       Decimal := 2;
  61.       filler := '@'
  62.     end;
  63.   with input[5] do
  64.     begin
  65.       x := 35;
  66.       y := 14;
  67.       len := 1;
  68.       up := 4;
  69.       down := 0;
  70.       typeof := 'L';
  71.       Decimal := 0;
  72.       filler := '@'
  73.     end;
  74. end;
  75.  
  76. Procedure setupscreen;
  77.   begin
  78.     clrscr;
  79.     cursoron(false);
  80.     center(2,'INPUT SCREEN TEST');
  81.     center(3,'* Hit ESC to Cancel Screen Input *');
  82.     gotoxy(2,8);
  83.     Write('Enter your name [Last, First]:');
  84.     gotoxy(50,8); write(',');
  85.     gotoxy(2,10);
  86.     write('Enter Date of Payment:');
  87.     gotoxy(2,12);
  88.     write('Enter Amount of Payment');
  89.     gotoxy(2,14);
  90.     write('Was this payment Late [Y,N]:');
  91.     gotoxy(1,20);
  92.     writeln('Try entering bad numbers or dates.  Move around with the');
  93.     writeln('arrow keys, back space etc.');
  94.   end;
  95.  
  96. Procedure Dumpdata;
  97. begin
  98.   color(15,1,false,false,false);
  99.   clrscr;
  100.   trim(Firstname);
  101.   writeln('Your Name: ',Firstname,' ',lastname);
  102.   writeln;
  103.   writeln('Date of payment: ',Date1);
  104.   writeln;
  105.   writeln('Amount paid: $',amountpaid);
  106.   writeln;
  107.   if latepayment then writeln('This was a latepayment!')
  108.     else writeln('This payment was on Time');
  109. end;
  110.  
  111.  
  112. begin
  113.   setitup;
  114.   setupscreen;
  115.   cursoron(true);
  116.   If getinput(1,0,15) then
  117.     begin
  118.     Lastname := input[1].filler;
  119.     Firstname := input[2].filler;
  120.     Date1 := input[3].filler;
  121.     Amountpaid := input[4].filler;
  122.     If input[5].filler = 'Y' then
  123.       latepayment := True
  124.     else
  125.       Latepayment := False;
  126.     clrscr;
  127.     DumpData;
  128.     Delay(9000);
  129.     setupscreen;
  130.     cursoron(true);
  131.     If getinput(1,0,15) then
  132.       dumpdata
  133.     else
  134.       begin
  135.       clrscr;
  136.       write('Exit From Screen');
  137.       end
  138.     end
  139.   else
  140.     begin
  141.     clrscr;
  142.     Beep;
  143.     Write('You Canceled the Input Screen');
  144.     end;
  145.   delay(4000);
  146. end.
  147.