home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / PROG / PASCAL / BONUS507.ZIP / TPSWITCH.ARC / SWTEST.PAS next >
Encoding:
Pascal/Delphi Source File  |  1988-10-28  |  1.1 KB  |  54 lines

  1. program SwitchTest;
  2.   {-Demonstrates use of the TPSWITCH unit.}
  3.  
  4. uses
  5.   tpcrt, tpswitch;
  6.  
  7. var
  8.   I : Word;
  9.   Ch : Char;
  10. const
  11.   Values : array[WhichScreen] of Char = ('!', ' ');
  12.  
  13. begin
  14.   {select preferred modes to switch to}
  15.   MonoMode := 7;
  16.   ColorMode := CO80;
  17.  
  18.   {make sure we have dual displays}
  19.   if not HasDualDisplays then begin
  20.     WriteLn('This program requires dual displays');
  21.     Halt(1);
  22.   end;
  23.  
  24.   {display brief instructions}
  25.   CheckBreak := False;
  26.   Write('Press <Esc> to stop, any other key to switch screens...');
  27.   Delay(500);
  28.  
  29.   ClrScr;
  30.  
  31.   repeat
  32.     {display something}
  33.     Write(Values[CurrentScreen]);
  34.  
  35.     if KeyPressed then begin
  36.       Ch := ReadKey;
  37.  
  38.       {quit if ESC pressed}
  39.       if Ch = #27 then begin
  40.         SwitchScreens(Screen1);
  41.         Exit;
  42.       end
  43.       {else switch screens}
  44.       else if CurrentScreen = Screen1 then
  45.         SwitchScreens(Screen2)
  46.       else
  47.         SwitchScreens(Screen1);
  48.  
  49.       {increment counter for current screen}
  50.       Inc(Values[CurrentScreen]);
  51.     end;
  52.   until False;
  53. end.
  54.