home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / WINDOWS.ZIP / DEMO.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1989-07-12  |  3.3 KB  |  107 lines

  1.   {   SCREEN.TPU demonstration program.
  2.       Written 7/12/89 by John Gatewood Ham
  3.       for Turbo Pascal 5.5
  4.  
  5.       "Created using Turbo Pascal, copyright (c) Borland International,
  6.        1987, 1988."                                              }
  7.  
  8. PROGRAM demo(input,output);
  9. USES dos,crt,screen;
  10. var  topscreen:wrdptr;
  11.  
  12.   procedure showinitialscreen;
  13.   var junk:char;
  14.   begin
  15.      clrscr;
  16.      writeln('Here is a sample of how to use the SCREEN TPU.');
  17.      writeln;
  18.      writeln('PROCEDURE SHOWHELP;');
  19.      writeln;
  20.      writeln('  PROCEDURE showhelpdata;');
  21.      writeln('  begin');
  22.      writeln('    {do whatever}');
  23.      writeln('  end;');
  24.      writeln;
  25.      writeln('BEGIN');
  26.      writeln;
  27.      writeln('  PUSH_SCREEN;                              <-- save current screen');
  28.      writeln;
  29.      writeln('  ShowHelpData;                             <-- do whatever');
  30.      writeln;
  31.      writeln('           Example is a help screen.  It shows how to save window,');
  32.      writeln('        turn cursor off, draw a box around a new window, fill window');
  33.      writeln('        WITH help text, wait for the user to hit any key,THEN turn');
  34.      writeln('        cursor on, restore previous window values.');
  35.      writeln;
  36.      writeln('  POP_SCREEN;                               <-- put old screen back');
  37.      writeln;
  38.      writeln('END;');
  39.      writeln('Hit F1 to continue');
  40.      repeat
  41.        junk:=readkey;
  42.        if junk=#0 then junk:=readkey;
  43.      until ord(junk) = 59;
  44.   end;
  45.  
  46.   procedure showhelpdatab;
  47.   var
  48.     windowmin,windowmax:word;
  49.   BEGIN
  50.     windowmin:=windmin;
  51.     windowmax:=windmax;
  52.     drawbox(1,1,40,10);
  53.     gotoxy(2,2);
  54.     writeln('This screen is another new screen,');
  55.     writeln('but the old screen will be restored');
  56.     writeln('when you press any key.');
  57.     writeln;
  58.     write('  Hit any key to restore previous page');
  59.     normvideo;
  60.     waitforkey;
  61.     window(lo(windowmin)+1,hi(windowmin)+1,
  62.            lo(windowmax)+1,hi(windowmax)+1);
  63.   END;
  64.  
  65.   procedure showhelpdata;
  66.   var
  67.     windowmin,windowmax:word;
  68.     junk:char;
  69.     thisscreen:wrdptr;
  70.   BEGIN
  71.     windowmin:=windmin;
  72.     windowmax:=windmax;
  73.     drawbox(3,3,77,22);
  74.     writeln('This screen is the new screen.');
  75.     writeln;
  76.     writeln('        NOTE:  As long as you have enough ram, you could go several');
  77.     writeln('        layers deep (call PUSH_SCREEN several times) before calling');
  78.     writeln('        POP_SCREEN to implement a windows-like environment.');
  79.     writeln('        While in each window only your imagination limits the');
  80.     writeln('        possibilities.');
  81.     writeln;
  82.     writeln('  Hit any key to continue');
  83.     waitforkey;
  84.     push_screen(thisscreen);
  85.     showhelpdatab;
  86.     pop_screen(thisscreen);
  87.     highvideo;
  88.     gotoxy(1,16);    { remember this is relative to box coordinates;
  89.                        I spent 1/2 hour trying to figure out what was
  90.                        wrong using 4, 21 to place my line.... }
  91.     textcolor(15+blink);
  92.     writeln('  Please hit a key to return to original screen');
  93.     normvideo;
  94.     waitforkey;
  95.  
  96.     window(lo(windowmin)+1,hi(windowmin)+1,
  97.            lo(windowmax)+1,hi(windowmax)+1);
  98.   END;
  99.  
  100. BEGIN
  101.   ShowInitialScreen;
  102.   PUSH_SCREEN(topscreen);
  103.   ShowHelpData;
  104.   POP_SCREEN(topscreen);
  105.   gotoxy(1,25);
  106. END.
  107.