Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2001-03

black on white with Win32

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Andreas K. Foerster

Hello,

I found a trick to get black on white in Win32 - but only in Win32:

uses
CRT;
begin
{$IFDEF WIN32}
TextAttr:=$F0;
{$ENDIF}
ClrScr;
WriteLn('black on white?');
ReadLn;
end.

Attention:
If you would use it under Dos or Linux without the conditional, you would get a GRAY background and BLINKING text in textmode! With a WIN32-binary it doesn't blink, even when you switch to textmode. (I don't know why)

Noah silva
to Andreas K. Foerster

Well change it to:

uses crt;
 begin
  {$IFDEF WIN32}
  TextAttr:=$F0;
  {$ELSE}
  textcolor(black);
  textbackground(white);
  {$ENDIF}
  ClrScr;
  WriteLn('black on white?');
  ReadLn;
 end.

Better yet, The CRT unit for windows could be modified to work with your trick. I don't know if it supports textcolor/textbackground at all, but I assume it could be made to using other textattributes.

thanks,
Noah Silva

Andreas K. Foerster wrote 25 lines
Hello, I found a trick to get black on white in Win32 - but only in Win32: uses CRT; begin {$IFDEF WIN32} TextAttr:=$F0; {$ENDIF} ClrScr; WriteLn('black on white?'); ReadLn; end. Attention: If you would use it under Dos or Linux without the conditional, you would get a GRAY background and BLINKING text in textmode! With a WIN32-binary it doesn't blink, even when you switch to textmode. (I don't know why) _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Andreas K. Foerster
to Noah silva
Noah silva wrote
Well change it to:

[...]

textbackground(white);

[...]

That doesn't work. It sets a lightgray background (on any system). That's why I had to do the trick.

I don't know if it supports textcolor/textbackground at all,

It supports it as on any other platform.
Just the "blink"-bit leads to highlight background - that is, what I used in the trick.

BTW. under Linux black on white is the standard when startet in an xterm.

Tschuess Andreas