home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / minigen.zip / WIDGIT.PAS < prev    next >
Pascal/Delphi Source File  |  1988-02-20  |  6KB  |  194 lines

  1. {$R-}    {Range checking off}
  2. {$B-}    {Boolean short circuiting off}
  3. {$S+}    {Stack checking on}
  4. {$I+}    {I/O checking on}
  5. {$N-}    {No numeric coprocessor}
  6. {$M 65500,16384,655360} {Turbo 3 default stack and heap}
  7.  
  8. {
  9.   This program demonstrates the use of
  10.      1) MiniGen generated screen procedures. WidgitOEScreen was generated
  11.         from WIDGIT.DAT (complete with, I admit,  spelling errors), and
  12.         serves as the base order entry screen for a fictional product.
  13.         On top of this, you could build in informational, or help windows.
  14.      2) EnterData() and EnterChar function calls. These calls are build
  15.         into a case structure which allows the user to move back and forth
  16.         among the fields using the up and down arrow keys. Tab and Shift Tab
  17.         can be used to circumnavigate the EnterChar() field calls.
  18.      3) UserExitSet is assisned the same exit values as the data entry calls
  19.         so values are returned. ESC, however, causes no change.
  20.      4) Range checking on numeric data.
  21. }
  22.  
  23. Program WidgitProg(Input,Output);
  24.  
  25. Uses
  26.   Crt,
  27.   Dos,
  28.   MGProg;
  29.  
  30. {$I WIDGIT.INC}          { Screen procedure developed with MiniGen }
  31. {$I CURSOR.INC}
  32.  
  33. Var
  34.   ReturnCode  : Integer;
  35.   CurrField   : Integer;
  36.   Continue    : Char;
  37.   Name        : String[25];
  38.   Addr1,Addr2 : String[30];
  39.   City        : String[12];
  40.   State       : String[2];
  41.   Zip         : String[5];
  42.   SSN1        : String[3];
  43.   SSN2        : String[2];
  44.   SSN3        : String[4];
  45.   Cash,Check,
  46.   Charge,Ch   : Char;
  47.   Each,Box,
  48.   _Case       : Char;
  49.   Quantity    : Integer;
  50.   Discount    : Integer;
  51.   Price       : Real;
  52.   Extension   : Real;
  53.  
  54. Procedure MainLoop;      { Main program logic }
  55. Begin
  56. TextBackground(Blue);
  57. ClrScr;
  58. TextBackground(Magenta);
  59. TextColor(Black);
  60. WidgitOEScreen;
  61. UserExitSet := [9,15,72,80];
  62. CurrField   := 0;
  63. ReturnCode  := 80;            {** UpArr = 72, DnArr = 80 **}
  64. While (ReturnCode <> 27 ) do
  65.   Begin
  66.   Case ReturnCode of
  67.     72,15
  68.        : If (CurrField = 1) then
  69.            CurrField := 18
  70.          Else
  71.            Dec(CurrField);
  72.     9,80,0,13,-13
  73.        : If (CurrField = 18) then
  74.            CurrField := 1
  75.          Else
  76.            Inc(CurrField);
  77.     End;
  78.   CursorOff;
  79.   If CurrField in [10..15] then
  80.     CursorOn;
  81.   Case CurrField of
  82.      1 : ReturnCode := EnterData(Name, 'S',22, 7,25,0,78,$87,[27,72,80]);
  83.      2 : ReturnCode := EnterData(Addr1,'S',22, 8,30,0,78,$87,[27,72,80]);
  84.      3 : ReturnCode := EnterData(Addr2,'S',22, 9,30,0,78,$87,[27,72,80]);
  85.      4 : ReturnCode := EnterData(City, 'S',22,10,12,0,78,$87,[27,72,80]);
  86.      5 : ReturnCode := EnterData(State,'U',36,10, 2,0,78,$87,[27,72,80]);
  87.      6 : ReturnCode := EnterData(Zip,  'N',40,10, 5,0,78,$87,[27,72,80]);
  88.      7 : ReturnCode := EnterData(SSN1, 'N',22,12, 3,0,95,$87,[27,72,80]);
  89.      8 : ReturnCode := EnterData(SSN2, 'N',26,12, 2,0,95,$87,[27,72,80]);
  90.      9 : ReturnCode := EnterData(SSN3, 'N',29,12, 4,0,95,$87,[27,72,80]);
  91.     10 : Begin
  92.          GotoXY(28,16);
  93.          ReturnCode := EnterChar(Cash,['X','x'],[9,15,27,72,80]);
  94.          If ReturnCode <> 27 then Write(Upcase(Cash));
  95.          End;
  96.     11 : Begin
  97.          GotoXY(38,16);
  98.          ReturnCode := EnterChar(Check,['X','x'],[9,15,27,72,80]);
  99.          If ReturnCode <> 27 then Write(Upcase(Check));
  100.          End;
  101.     12 : Begin
  102.          GotoXY(49,16);
  103.          ReturnCode := EnterChar(Charge,['X','x'],[9,15,27,72,80]);
  104.          If ReturnCode <> 27 then Write(Upcase(Charge));
  105.          End;
  106.     13 : Begin
  107.          GotoXY(28,17);
  108.          ReturnCode := EnterChar(Each,['X','x'],[9,15,27,72,80]);
  109.          If ReturnCode <> 27 then Write(Upcase(Each));
  110.          End;
  111.     14 : Begin
  112.          GotoXY(36,17);
  113.          ReturnCode := EnterChar(Box,['X','x'],[9,15,27,72,80]);
  114.          If ReturnCode <> 27 then Write(Upcase(Box));
  115.          End;
  116.     15 : Begin
  117.          GotoXY(45,17);
  118.          ReturnCode := EnterChar(_Case,['X','x'],[9,15,27,72,80]);
  119.          If ReturnCode <> 27 then Write(Upcase(_Case));
  120.          End;
  121.     16 : Begin
  122.          GotoXY(1,1);
  123.          LowerInt   := 1;
  124.          UpperInt   := 144;
  125.          ReturnCode := EnterData(Quantity, 'I',22,18,6,0,80,$87,[27,72,80]);
  126.          End;
  127.     17 : Begin
  128.          LowerReal  := 0.50;
  129.          UpperReal  := 100.00;
  130.          ReturnCode := EnterData(Price,'R',38,18,6,2,80,$87,[27,72,80]);
  131.          End;
  132.     18 : Begin
  133.          LowerInt   := 0;
  134.          UpperInt   := 100;
  135.          ReturnCode := EnterData(Discount, 'I',22,19,2,0,80,$87,[27,72,80]);
  136.          End;
  137.     End;
  138.   End;
  139. TextColor(Cyan);
  140. Extension  := (Price * ((100 - Discount) / 100)) * Quantity;
  141. GotoXY(22,20);
  142. Writeln(Extension:8:2);
  143. Writeln;
  144. Write('Any key to Exit... ');
  145. Ch := ReadKey;
  146. End;
  147.  
  148. Begin
  149. ClrScr;
  150. MaxLimits;
  151. MG_TimeOut := 30;
  152. Name       := '';
  153. Addr1      := '';
  154. Addr2      := '';
  155. City       := '';
  156. State      := '';
  157. Zip        := '';
  158. SSN1       := '';
  159. SSN2       := '';
  160. SSN3       := '';
  161. Cash       := ' ';
  162. Check      := ' ';
  163. Charge     := ' ';
  164. Each       := ' ';
  165. Box        := ' ';
  166. _Case      := ' ';
  167. Quantity   := 1;
  168. Discount   := 0;
  169. Price      := 0.0;
  170.                         {** No screens defined in this demo **}
  171. MainLoop;
  172. TextBackground(Black);
  173. TextColor(White);
  174. ClrScr;
  175. CursorOn;
  176. Writeln(Name);
  177. Writeln(Addr1);
  178. Writeln(Addr2);
  179. Writeln(City);
  180. Writeln(State);
  181. Writeln(Zip);
  182. Writeln(SSN1,' - ',SSN2,' - ',SSN3);
  183. Writeln(Cash);
  184. Writeln(Check);
  185. Writeln(Charge);
  186. Writeln(Each);
  187. Writeln(Box);
  188. Writeln(_Case);
  189. Writeln(Quantity);
  190. Writeln(Price:8:2);
  191. Writeln(Discount);
  192. Writeln(Extension:8:2);
  193. End.
  194.