home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
progm
/
minigen.zip
/
WIDGIT.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1988-02-20
|
6KB
|
194 lines
{$R-} {Range checking off}
{$B-} {Boolean short circuiting off}
{$S+} {Stack checking on}
{$I+} {I/O checking on}
{$N-} {No numeric coprocessor}
{$M 65500,16384,655360} {Turbo 3 default stack and heap}
{
This program demonstrates the use of
1) MiniGen generated screen procedures. WidgitOEScreen was generated
from WIDGIT.DAT (complete with, I admit, spelling errors), and
serves as the base order entry screen for a fictional product.
On top of this, you could build in informational, or help windows.
2) EnterData() and EnterChar function calls. These calls are build
into a case structure which allows the user to move back and forth
among the fields using the up and down arrow keys. Tab and Shift Tab
can be used to circumnavigate the EnterChar() field calls.
3) UserExitSet is assisned the same exit values as the data entry calls
so values are returned. ESC, however, causes no change.
4) Range checking on numeric data.
}
Program WidgitProg(Input,Output);
Uses
Crt,
Dos,
MGProg;
{$I WIDGIT.INC} { Screen procedure developed with MiniGen }
{$I CURSOR.INC}
Var
ReturnCode : Integer;
CurrField : Integer;
Continue : Char;
Name : String[25];
Addr1,Addr2 : String[30];
City : String[12];
State : String[2];
Zip : String[5];
SSN1 : String[3];
SSN2 : String[2];
SSN3 : String[4];
Cash,Check,
Charge,Ch : Char;
Each,Box,
_Case : Char;
Quantity : Integer;
Discount : Integer;
Price : Real;
Extension : Real;
Procedure MainLoop; { Main program logic }
Begin
TextBackground(Blue);
ClrScr;
TextBackground(Magenta);
TextColor(Black);
WidgitOEScreen;
UserExitSet := [9,15,72,80];
CurrField := 0;
ReturnCode := 80; {** UpArr = 72, DnArr = 80 **}
While (ReturnCode <> 27 ) do
Begin
Case ReturnCode of
72,15
: If (CurrField = 1) then
CurrField := 18
Else
Dec(CurrField);
9,80,0,13,-13
: If (CurrField = 18) then
CurrField := 1
Else
Inc(CurrField);
End;
CursorOff;
If CurrField in [10..15] then
CursorOn;
Case CurrField of
1 : ReturnCode := EnterData(Name, 'S',22, 7,25,0,78,$87,[27,72,80]);
2 : ReturnCode := EnterData(Addr1,'S',22, 8,30,0,78,$87,[27,72,80]);
3 : ReturnCode := EnterData(Addr2,'S',22, 9,30,0,78,$87,[27,72,80]);
4 : ReturnCode := EnterData(City, 'S',22,10,12,0,78,$87,[27,72,80]);
5 : ReturnCode := EnterData(State,'U',36,10, 2,0,78,$87,[27,72,80]);
6 : ReturnCode := EnterData(Zip, 'N',40,10, 5,0,78,$87,[27,72,80]);
7 : ReturnCode := EnterData(SSN1, 'N',22,12, 3,0,95,$87,[27,72,80]);
8 : ReturnCode := EnterData(SSN2, 'N',26,12, 2,0,95,$87,[27,72,80]);
9 : ReturnCode := EnterData(SSN3, 'N',29,12, 4,0,95,$87,[27,72,80]);
10 : Begin
GotoXY(28,16);
ReturnCode := EnterChar(Cash,['X','x'],[9,15,27,72,80]);
If ReturnCode <> 27 then Write(Upcase(Cash));
End;
11 : Begin
GotoXY(38,16);
ReturnCode := EnterChar(Check,['X','x'],[9,15,27,72,80]);
If ReturnCode <> 27 then Write(Upcase(Check));
End;
12 : Begin
GotoXY(49,16);
ReturnCode := EnterChar(Charge,['X','x'],[9,15,27,72,80]);
If ReturnCode <> 27 then Write(Upcase(Charge));
End;
13 : Begin
GotoXY(28,17);
ReturnCode := EnterChar(Each,['X','x'],[9,15,27,72,80]);
If ReturnCode <> 27 then Write(Upcase(Each));
End;
14 : Begin
GotoXY(36,17);
ReturnCode := EnterChar(Box,['X','x'],[9,15,27,72,80]);
If ReturnCode <> 27 then Write(Upcase(Box));
End;
15 : Begin
GotoXY(45,17);
ReturnCode := EnterChar(_Case,['X','x'],[9,15,27,72,80]);
If ReturnCode <> 27 then Write(Upcase(_Case));
End;
16 : Begin
GotoXY(1,1);
LowerInt := 1;
UpperInt := 144;
ReturnCode := EnterData(Quantity, 'I',22,18,6,0,80,$87,[27,72,80]);
End;
17 : Begin
LowerReal := 0.50;
UpperReal := 100.00;
ReturnCode := EnterData(Price,'R',38,18,6,2,80,$87,[27,72,80]);
End;
18 : Begin
LowerInt := 0;
UpperInt := 100;
ReturnCode := EnterData(Discount, 'I',22,19,2,0,80,$87,[27,72,80]);
End;
End;
End;
TextColor(Cyan);
Extension := (Price * ((100 - Discount) / 100)) * Quantity;
GotoXY(22,20);
Writeln(Extension:8:2);
Writeln;
Write('Any key to Exit... ');
Ch := ReadKey;
End;
Begin
ClrScr;
MaxLimits;
MG_TimeOut := 30;
Name := '';
Addr1 := '';
Addr2 := '';
City := '';
State := '';
Zip := '';
SSN1 := '';
SSN2 := '';
SSN3 := '';
Cash := ' ';
Check := ' ';
Charge := ' ';
Each := ' ';
Box := ' ';
_Case := ' ';
Quantity := 1;
Discount := 0;
Price := 0.0;
{** No screens defined in this demo **}
MainLoop;
TextBackground(Black);
TextColor(White);
ClrScr;
CursorOn;
Writeln(Name);
Writeln(Addr1);
Writeln(Addr2);
Writeln(City);
Writeln(State);
Writeln(Zip);
Writeln(SSN1,' - ',SSN2,' - ',SSN3);
Writeln(Cash);
Writeln(Check);
Writeln(Charge);
Writeln(Each);
Writeln(Box);
Writeln(_Case);
Writeln(Quantity);
Writeln(Price:8:2);
Writeln(Discount);
Writeln(Extension:8:2);
End.