Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!snorkelwacker!husc6!bu-cs!austin From: austin@bucsf.bu.edu (Austin Ziegler) Newsgroups: comp.lang.pascal Subject: Re: Reverse Video in Turbo Pascal Message-ID: <40862@bu-cs.BU.EDU> Date: 20 Oct 89 13:49:32 GMT References: <40680@bu-cs.BU.EDU> <3341@nmtsun.nmt.edu> <89Oct18.122326edt.18681@me.utoronto.ca> Sender: daemon@bu-cs.BU.EDU Organization: Boston University College of Engineering Lines: 54 In-reply-to: zougas@me.utoronto.ca's message of 18 Oct 89 16:23:15 GMT >>>>> On 18 Oct 89 16:23:15 GMT, zougas@me.utoronto.ca ("Athanasios(Tom) Zougas") said: Tom> In article <3341@nmtsun.nmt.edu> jrwsnsr@nmtsun.nmt.edu (Jonathan R. Watts) writes: >In article <40680@bu-cs.BU.EDU>, tasos@bu-cs.BU.EDU (Anastasios Kotsikonas) writes: >> Does anyone know how to write characters in reverse video in Turbo Pascal >> using the crt unit? I know it doesn't work with the usual escape sequence. >> Strangly enough, the escape sequence works without the crt unit. > >To write reverse video in TP you could use > TextAttr := (TextAttr shr 4) + (TextAttr shl 4); Tom> A better way is to set Tom> directvideo := false; [because it then allows ANSI to decode the strings] Even better would be to use the CRT unit, and, if you know the colors (which most of us do), actually set the colors using TextBackground and TextColor. In your own unit, include the following three functions FUNCTION GetBackground: BYTE; BEGIN { Get the current background color } GetBackground:=TextAttr SHR 4; END; { GetBackground } FUNCTION GetColor: BYTE; BEGIN { Get the current foreground color } GetColor:=(TextAttr SHL 4) SHR 4; END; { GetColor } PROCEDURE ReverseColors; VAR Fg, Bg: BYTE; BEGIN { Reverse the colors ignoring high intensity and blink } Fg:=GetColor; Bg:=GetBackground; IF Fg > 15 { Strip the high intensity } THEN Dec (Fg,8); IF Bg > 15 { Strip the blink } THEN Dec (Bg,8); TextColor (Bg); TextBackground (Fg); END; { ReverseColors } These three should fix the problem, and if included into a personal unit, they should not cause any problems whatsoever. Elminster, the Sage of Shadowdale (austin@bucsf.bu.edu) 700 Commonwealth Box 2094, Boston, MA 02215 "S.F.'S NO GOOD!!" They bellow till we're deaf. "But this looks good." "WELL THEN IT'S NOT S.F.!!" -- Kingsley Amis