home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / ansi / ansicrt / testans.pas < prev   
Encoding:
Pascal/Delphi Source File  |  1988-05-28  |  2.0 KB  |  89 lines

  1. Uses anscrt;
  2.  
  3. var
  4.  x, y, i : byte;
  5.  NameStr : string;
  6.  ch      : char;
  7.  
  8. begin
  9.   TextBackground(Black);
  10.   TextColor(LightGray);
  11.   ClrScr;
  12.   x := 0;
  13.   y := 0;
  14.   Write('Test of ANSCRT unit. @');
  15.   x := WhereX;
  16.   y := WhereY;
  17.   GotoXY(12,22);
  18.   TextColor(White + Blink);
  19.   Write('The @ sign above is on line ',y,' at column ',x - 1);
  20.   GotoXY(1,y + 1);
  21.   TextColor(Yellow);
  22.   TextBackground(Green);
  23.   Write('(Bright yellow on green.)  Enter your name (in Bright cyan on blue): ');
  24.   TextColor(LightCyan);
  25.   TextBackground(Blue);
  26.   ClrEol;
  27.   ReadLn(NameStr);
  28.   LowVideo;
  29.   Write('Test LowVideo, Keypressed and ReadKey - Press any function key');
  30.   Repeat until Keypressed;
  31.   ch := ReadKey;
  32.   If ch = #0 then
  33.    begin
  34.      TextColor(White + Blink);
  35.      Write(' Special key');
  36.      ch := ReadKey;
  37.      TextColor(cyan);
  38.    end;
  39.   WriteLn;
  40.   HighVideo;
  41.   WriteLn('Test HighVideo and GetKey - Press another key');
  42.   ch := GetKey;
  43.   If ch = #32 then Write('Space');
  44.   If ch = #9  then Write('Tab');
  45.   If ch = #8  then Write('Backspace');
  46.   Write(' ',ch);
  47.   GotoXY(1,22);
  48.   LowVideo;
  49.   ClrEol;
  50.   Write('Test of ClrEol - Press a key');
  51.   ch := GetKey;
  52.   TextColor(White);
  53.   TextBackground(Red);
  54.   GotoXY(1,22);
  55.   ClrEol;
  56.   Write('All gone in white on red');
  57.   Write('    Press any key');
  58.   ch := ReadKey;
  59.   GotoXY(1,22);
  60.   NormVideo;
  61.   ClrEol;
  62.   Write('Press any key for color demo');
  63.   ch := GetKey;
  64.   WriteLn(ch);
  65.   ClrScr;
  66.   for i := 0 to 7 do
  67.     begin
  68.       GotoXY(1,i + 1);
  69.       TextColor(i);
  70.       TextBackground(Black);
  71.       ClrEol;
  72.       Write('TextColor ',i);
  73.       TextColor(i + 8);
  74.       Write(' TextColor ',i + 8:2);
  75.       TextColor(i + Blink);
  76.       Write(' TextColor ',i + Blink);
  77.       TextColor(i + 8 + Blink);
  78.       Write(' TextColor ',i + 8 + Blink);
  79.       TextBackground(i);
  80.       ClrEol;
  81.       TextColor(White);
  82.       Write('  TextBackground ',i);
  83.     end;
  84.       TextBackground(Black);
  85.       LowVideo;
  86.       WriteLn;
  87.       WriteLn;
  88.       Write('Finished');
  89. end.