home *** CD-ROM | disk | FTP | other *** search
- { SCREEN.TPU demonstration program.
- Written 7/12/89 by John Gatewood Ham
- for Turbo Pascal 5.5
-
- "Created using Turbo Pascal, copyright (c) Borland International,
- 1987, 1988." }
-
- PROGRAM demo(input,output);
- USES dos,crt,screen;
- var topscreen:wrdptr;
-
- procedure showinitialscreen;
- var junk:char;
- begin
- clrscr;
- writeln('Here is a sample of how to use the SCREEN TPU.');
- writeln;
- writeln('PROCEDURE SHOWHELP;');
- writeln;
- writeln(' PROCEDURE showhelpdata;');
- writeln(' begin');
- writeln(' {do whatever}');
- writeln(' end;');
- writeln;
- writeln('BEGIN');
- writeln;
- writeln(' PUSH_SCREEN; <-- save current screen');
- writeln;
- writeln(' ShowHelpData; <-- do whatever');
- writeln;
- writeln(' Example is a help screen. It shows how to save window,');
- writeln(' turn cursor off, draw a box around a new window, fill window');
- writeln(' WITH help text, wait for the user to hit any key,THEN turn');
- writeln(' cursor on, restore previous window values.');
- writeln;
- writeln(' POP_SCREEN; <-- put old screen back');
- writeln;
- writeln('END;');
- writeln('Hit F1 to continue');
- repeat
- junk:=readkey;
- if junk=#0 then junk:=readkey;
- until ord(junk) = 59;
- end;
-
- procedure showhelpdatab;
- var
- windowmin,windowmax:word;
- BEGIN
- windowmin:=windmin;
- windowmax:=windmax;
- drawbox(1,1,40,10);
- gotoxy(2,2);
- writeln('This screen is another new screen,');
- writeln('but the old screen will be restored');
- writeln('when you press any key.');
- writeln;
- write(' Hit any key to restore previous page');
- normvideo;
- waitforkey;
- window(lo(windowmin)+1,hi(windowmin)+1,
- lo(windowmax)+1,hi(windowmax)+1);
- END;
-
- procedure showhelpdata;
- var
- windowmin,windowmax:word;
- junk:char;
- thisscreen:wrdptr;
- BEGIN
- windowmin:=windmin;
- windowmax:=windmax;
- drawbox(3,3,77,22);
- writeln('This screen is the new screen.');
- writeln;
- writeln(' NOTE: As long as you have enough ram, you could go several');
- writeln(' layers deep (call PUSH_SCREEN several times) before calling');
- writeln(' POP_SCREEN to implement a windows-like environment.');
- writeln(' While in each window only your imagination limits the');
- writeln(' possibilities.');
- writeln;
- writeln(' Hit any key to continue');
- waitforkey;
- push_screen(thisscreen);
- showhelpdatab;
- pop_screen(thisscreen);
- highvideo;
- gotoxy(1,16); { remember this is relative to box coordinates;
- I spent 1/2 hour trying to figure out what was
- wrong using 4, 21 to place my line.... }
- textcolor(15+blink);
- writeln(' Please hit a key to return to original screen');
- normvideo;
- waitforkey;
-
- window(lo(windowmin)+1,hi(windowmin)+1,
- lo(windowmax)+1,hi(windowmax)+1);
- END;
-
- BEGIN
- ShowInitialScreen;
- PUSH_SCREEN(topscreen);
- ShowHelpData;
- POP_SCREEN(topscreen);
- gotoxy(1,25);
- END.