home *** CD-ROM | disk | FTP | other *** search
- {TUG PDS CERT 1.01 (Pascal)
-
- ==========================================================================
-
- TUG PUBLIC DOMAIN SOFTWARE CERTIFICATION
-
- The Turbo User Group (TUG) is recognized by Borland International as the
- official support organization for Turbo languages. This file has been
- compiled and verified by the TUG library staff. We are reasonably certain
- that the information contained in this file is public domain material, but
- it is also subject to any restrictions applied by its author.
-
- This diskette contains PROGRAMS and/or DATA determined to be in the PUBLIC
- DOMAIN, provided as a service of TUG for the use of its members. The
- Turbo User Group will not be liable for any damages, including any lost
- profits, lost savings or other incidental or consequential damages arising
- out of the use of or inability to use the contents, even if TUG has been
- advised of the possibility of such damages, or for any claim by any
- other party.
-
- To the best of our knowledge, the routines in this file compile and function
- properly in accordance with the information described below.
-
- If you discover an error in this file, we would appreciate it if you would
- report it to us. To report bugs, or to request information on membership
- in TUG, please contact us at:
-
- Turbo User Group
- PO Box 1510
- Poulsbo, Washington USA 98370
-
- --------------------------------------------------------------------------
- F i l e I n f o r m a t i o n
-
- * DESCRIPTION
- File used with FIELD.PAS.
-
- * ASSOCIATED FILES
- FIELD.PAS
- FLDDEMO.PAS
- FLDTEST.PAS
- OLDDEMO.PAS
- FIELD.TXT
-
- * CHECKED BY
- DRM 08/08/88
-
- * KEYWORDS
- TURBO PASCAL V4.0
-
- ==========================================================================
- }
- Program olddemo;
-
- Uses Crt,Dos,field;
-
- { This program illustrates the use of the field functions to generate
- a screen display and to allow input. It has no other purpose. }
-
- Type linestring = String[80];
-
- Var pickcount,titlenumber,fldnum,maxfldnum,keyreturn: Byte;
- title1,items1,title2,items2,title3,items3: Byte;
- pointer,marker: Char;
- title,path,description: linestring;
- picklist: Array[1..10] Of String[30];
- paperlength: Integer;
- rate,amount: Real;
- justify,pitch,lines: Byte;
-
- Procedure writepicklist(col,row,maxpick,titlenumber: Byte);
-
- Begin
- GotoXY(col,row);
- Write(picklist[titlenumber]);
- For pickcount:=1 To maxpick Do
- Begin
- GotoXY(col+1,row+pickcount);
- Write(marker,' ',picklist[titlenumber+pickcount])
- End;
- End;
-
- Begin { Demo program }
- reversevideo:=False;
- zerovoid:=True;
- hitxtcolor:=Yellow;
- lotxtcolor:=LightGray;
- txtbkgnd:=Black;
- pointer:=chr(pickpointer);
- marker:=chr(pickmarker);
- cursor(hidden);
- TextMode(CO80);
- TextColor(lotxtcolor);
- TextBackground(txtbkgnd);
- ClrScr;
-
- { Display headings and default values }
- title:='Interactive Data Entry Demonstration';
- GotoXY(39-(length(title) Div 2),2);Write(title);
-
- path:=''; description:='';
- paperlength:=66;
- rate:=0.0; amount:=0.0;
- justify:=1; pitch:=1; lines:=1;
- GotoXY(9,10); Write('Path: ');
- GotoXY(2,11); Write('Description: ');
- GotoXY(5,13); Write('Page (paper) Length: ',paperlength:3);
- GotoXY(16,14); Write('Amount: ',amount:7:2);
- GotoXY(18,15); Write('Rate: ',rate:5:3);
-
- { Define picklists }
- picklist[1]:='Format';
- picklist[2]:='Unjustified';
- picklist[3]:='Justified';
- title1:=1;
- items1:=2;
- picklist[4]:='Pitch';
- picklist[5]:='10';
- picklist[6]:='12';
- picklist[7]:='16';
- title2:=4;
- items2:=3;
- picklist[8]:='Lines/Inch';
- picklist[9]:='Six';
- picklist[10]:='Eight';
- title3:=8;
- items3:=2;
-
- { Write pick lists }
- writepicklist(53,8,items1,title1);
- writepicklist(53,12,items2,title2);
- writepicklist(53,17,items3,title3);
-
- { Step through fields }
- maxfldnum:=8;
- fldnum:=1;
- firstpass:=True;
-
- Repeat { Until screen accepted or canceled }
-
- Repeat { Until data entry or editing completed }
-
- { Execute the next field function }
- Case fldnum Of
- 1: keyreturn:=editfield(15,10,30,0,caplet,optional,path);
- 2: keyreturn:=editfield(15,11,30,0,alsymb,manditory,description);
- 3: keyreturn:=editfield(28,13,3,0,usnint,optional,paperlength);
- 4: keyreturn:=editfield(24,14,7,2,sgndec,optional,amount);
- 5: keyreturn:=editfield(26,15,5,3,usndec,manditory,rate);
- 6: keyreturn:=getpick(53,9,items1,justify,picklist[title1+1]);
- 7: keyreturn:=getpick(53,13,items2,pitch,picklist[title2+1]);
- 8: keyreturn:=getpick(53,18,items3,lines,picklist[title3+1]);
- Else
- End; { fldnum Case statement }
-
- { Select the next fldnum based on keyreturn }
- Case keyreturn Of
- enterkey:
- If fldnum < maxfldnum
- Then inc(fldnum)
- Else fldnum:=0;
- uparrowkey:
- If fldnum > 1
- Then dec(fldnum)
- Else fldnum:=maxfldnum;
- dnarrowkey:
- If fldnum < maxfldnum
- Then inc(fldnum)
- Else fldnum:=1;
- tabkey:
- ; { no action }
- shiftabkey:
- ; { no action }
- esckey:
- If firstpass
- Then Write(char(7))
- Else fldnum:=0
- Else
- End; { keyreturn Case statement}
-
- Until fldnum = 0; { Data entry or editing completed }
-
- note('END to Accept, ENTER to Edit, ESC to exit!');
- Repeat
- keyreturn:=getspecialkey;
- If (keyreturn <> endkey) And
- (keyreturn <> enterkey) And
- (keyreturn <> esckey)
- Then
- errmsg('Must be END (Accept), ENTER (Edit), Or ESC (Exit)!');
- Until
- (keyreturn = enterkey) Or
- (keyreturn = endkey) Or
- (keyreturn = esckey);
- If keyreturn = enterkey Then
- Begin
- firstpass:=false;
- fldnum:=1
- End;
-
- Until
- (keyreturn = endkey) Or { Screen accepted }
- (keyreturn = esckey); { Screen cancled }
- cursor(underline); { cursor on }
- NormVideo;
- End. { Demo }