home *** CD-ROM | disk | FTP | other *** search
- PROGRAM Demo;
- {demonstrate BlueBag and AtSayGet TPU'S}
-
- {$V-}
- USES
- CRT,
- AtSayGet,
- BlueBag;
-
- TYPE
- PhoneType = STRING[14];
-
- VAR
- D1,D2 : DateType;
- Doc : TEXT;
- Change: LONGINT;
- AnyS : STRING;
-
- CONST
- Cont : BOOLEAN=True;
- Phone : PhoneType='( ) - ';
- AR : REAL=0.0;
- LI : LONGINT=0;
- I : INTEGER=0;
- W : WORD=0;
-
- BEGIN
- ClrScr;
- ReverseVideo; {DEMO}
- GoToXY(15, 5); WRITE('AtSayGet and BlueBag TPU Demo');
- RestoreVideo; {DEMO}
- GoToXY(16, 6); WRITE('Oh look -- Reverse video!'); DELAY(3000);
- CursorOff; {DEMO}
- GoToXY(17,10); WRITE('Heh...Where''s the cursor?');
- Delay(3000);
- CursorOn; {DEMO}
- SetCursor(0,StopScan); {DEMO}
- GoToXY(14,11); WRITE('Isn''t this a bit over doing it?');
- Delay(3000);
- RestoreCursor; {DEMO}
- GoToXY(1,20);
- WRITELN('After showing the WAIT function we will look at other goodies in windows.');
- WAIT; {DEMO}
- OpenWindow(20,1,75,15,Yellow,Blue,Single,' DATE FUNCTIONS ',RAM); {DEMO}
- D1:='890101'; D2:=''; Change:=0;
- WRITELN('DEMONSTRATING THE INCDAYS FUNCTION:');
- WRITELN('----------------------------------');
- WRITELN('This New Years day was ',D1);
- WRITE('Enter a number of days: '); READLN(Change);
- WRITE('The date that is ',Change,' days ');
- IF Change>=0 THEN WRITE('after ') ELSE WRITE('before ');
- WRITELN(D1,' is ',IncDate(D1,Change)); {DEMO}
- WRITELN;
- D1:=''; D2:='890101'; Change:=0;
- WRITELN('DEMONSTRATING THE DAYSBETWEEN FUNCTION:');
- WRITELN('--------------------------------------');
- WRITE('What is todays date [YrMoDy] '); READLN(D2);
- WRITE('When were you born? [YrMoDy] '); READLN(D1);
- WRITELN('My God! That was ',DaysBetween(D1,D2),' days ago!'); {DEMO}
- WAIT;
- OpenWindow(5,5,70,12,White,Red,Double,' STRING ROUTINES ',Disk); {DEMO}
- WRITELN;
- WRITELN('Before we move along I must comment on the grinding disks:');
- WRITELN('The image below this window was just saved to disk! Not the');
- WRITELN('fastest way but someone may see a use for it.');
- WRITELN;
- WAIT;
- ClrScr;
- WRITELN('OK. Let''s test the SPACE() procedure.');
- WRITELN('I will code "SPACE(30); WRITELN(''CENTER'')" so watch:');
- SPACE(30); WRITELN('CENTER'); {DEMO}
- WRITELN; WAIT;
- ClrScr;
- WRITELN('Please enter a line of text in lower case & press Enter:');
- READLN(AnyS);
- WRITELN('This demonstrates the UpperCase Function -');
- WRITELN(UpperCase(AnyS)); {DEMO}
- WAIT;
- ClrScr;
- WRITELN('After NoBlanks() takes care of your line it looks like this:');
- NoBlanks(AnyS); {DEMO}
- WRITELN(AnyS);
- WAIT; WRITELN;
- WRITELN('The Trim() Function also works but it''s hard to');
- WRITELN('demonstrate visually. You will find many uses for it.');
- WAIT;
- OpenWindow(1,1,50,22,Black,LightGray,32,' SCREEN TRICKS ',RAM);
- WRITELN('Here goes DrawBox()!'); Wait;
- DrawBox(1,4,47,19,1); Delay(500); {DEMO}
- DrawBox(5,2,22,12,2); Delay(500);
- DrawBox(10,15,40,18,240); Delay(500);
- DrawBox(15,5,45,20,219);
- GoToXY(1,18); WAIT;
- AnyS:='This big line of text will fill the screen.';
- FOR Change:=1 TO 20 DO WRITELN(AnyS);
- WRITELN('Now to test the Clear() procedure...'); WAIT;
- Clear(2,2,30,11); {DEMO}
- GoToXY(4,4); WRITE('Clear() works!');
- GoToXY(4,5); WAIT;
- OpenWindow(10,12,80,20,White+Blink,Green,1,' AtSayGet PROCEDURES ',RAM);
- DEC(TextAttr,Blink);
- WRITELN('The AtSayGet unit provides the functional equivilance of the');
- WRITELN('dBase @ Line,Row SAY "prompt" GET <variable> [PICTURE "template"]');
- WRITELN('command. A full range of editing keys are employed. See the');
- WRITELN('ATSAYGET.DOC file for details.');
- AtSayGetBoolean(2,6,'Continue?',Cont); {DEMO}
- WRITELN;
- IF Cont THEN WRITE('O.K.') ELSE WRITE('I insist!');
- Delay(2000);
- ClrScr; AnyS:='';
- AtSayGetStrLen(2,2,'What is your name?',AnyS,30); {DEMO}
- AtSayGetWord(2,3,'What is your age? ',W,2); {DEMO}
- AtSayGetStrPic(2,5,'What is your phone',Phone,'(999) 999-9999'); {DEMO}
- ClrScr;
- WRITELN('O.K. ',TRIM(AnyS),', this is a skill testing question'); {DEMO}
- WRITELN('involving negative numbers...');
- AtSayGetInt(2,4,'What do you owe on your car?',I,6); {DEMO}
- AtSayGetLongInt(2,5,'What is owing on your house?',LI,7); {DEMO}
- AtSayGetReal(2,6,'What are your monthly expenses to the cent?',AR,10,2); {DEMO}
- WRITELN; WAIT;
- OpenWindow(20,15,75,22,White,Black,240,' DEVICE FUNCTIONS ',RAM);
- Cont:=True;
- WHILE Cont DO
- BEGIN
- GoToXY(2,2); ClrEol;
- WRITE(Trim(AnyS),', your printer #1 is ');
- IF PrinterOnLine(1) THEN WRITE('on-line.') ELSE WRITE('NOT on-line.'); {DEMO}
- AtSayGetBoolean(2,5,'Try again?',Cont);
- IF Cont THEN CLEAR(1,3,48,5);
- END;
- ClrScr;
- AnyS:='BLUEBAG.DOC '; Cont:=True;
- WHILE Cont DO
- BEGIN
- AtSayGetStrLen(2,2,'Enter a file name',AnyS,12); WRITELN;
- IF OnFile(AnyS) THEN WRITELN(Trim(AnyS),' is on file.') {DEMO}
- ELSE WRITELN(Trim(AnyS),' is NOT on file.');
- AtSayGetBoolean(2,5,'Try again?',Cont);
- IF Cont THEN CLEAR(1,3,48,5);
- END;
- ClrScr; Cont:=True;
- AtSayGetBoolean(2,3,'Read the documentation now?',Cont); WRITELN;
- IF Cont THEN
- BEGIN
- IF OnFile('BLUEBAG.DOC') OR OnFile('ATSAYGET.DOC') THEN
- BEGIN
- OpenWindow(1,1,80,24,LightGray,Black,1,' DOCUMENTATION ',RAM);
- IF OnFile('BLUEBAG.DOC') THEN
- BEGIN
- ASSIGN(Doc,'BLUEBAG.DOC'); RESET(Doc); I:=1;
- WHILE NOT EOF(Doc) DO
- BEGIN
- Readln(Doc,AnyS); WRITELN(AnyS); INC(I);
- IF I=21 THEN
- BEGIN
- WAIT; GoToXY(1,WhereY); ClrEol; I:=1;
- END;
- END;
- CLOSE(Doc); WAIT; ClrScr;
- END
- ELSE
- BEGIN
- WRITELN('BLUEBAG.DOC IS NOT ON FILE.'); WAIT;
- END;
- ClrScr;
- IF OnFile('ATSAYGET.DOC') THEN
- BEGIN
- ASSIGN(Doc,'ATSAYGET.DOC'); RESET(Doc); I:=1;
- WHILE NOT EOF(Doc) DO
- BEGIN
- Readln(Doc,AnyS); WRITELN(AnyS); INC(I);
- IF I=21 THEN
- BEGIN
- WAIT; GoToXY(1,WhereY); ClrEol; I:=1;
- END;
- END;
- CLOSE(Doc); WAIT; ClrScr;
- END
- ELSE
- BEGIN
- WRITELN('ATSAYGET.DOC IS NOT ON FILE.'); WAIT;
- END;
- CloseWindow;
- END;
- END;
- CloseWindow; {DEMO}
- Delay(500);
- CloseWindow;
- Delay(500);
- CloseWindow;
- Delay(500);
- CloseWindow;
- Delay(500);
- CloseWindow;
- WRITELN; WRITELN;
- WRITELN('Well, I guess that is about it. 101 uses though.');
- END.
-