Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!munnari.oz.au!uniwa!cc.curtin.edu.au!cutmcvax!campbell From: campbell@cutmcvax.cs.curtin.edu.au (Trevor George Campbell CC361) Newsgroups: comp.lang.pascal Subject: Re: Reading characters in graphics mode Message-ID: Date: 19 Jun 91 03:38:40 GMT References: <1991Jun14.150309.5126@cunixf.cc.columbia.edu> Sender: news@cutmcvax.cs.curtin.edu.au (Usenet News System) Organization: Curtin University of Technology, Computing Science Lines: 41 Nntp-Posting-Host: cutmcvax.cs.curtin.edu.au stone@cunixb.cc.columbia.edu (Glenn Stone) writes: >There must an easy way to do this but I seem to have a mental block. >I'm writing a graphics mode equivalent of READLN(StringVariable) in >TP 5.5. This loop reads characters and tacks them onto a string >called T. The problem is in dealing with the backspace; I want the >pointer to back up and erase the last character, but the ' ' in >graphics mode doesn't do this. I need the equivalent of ClrEol. >How do you do it? Thanks in advance... > #8 : begin { backspace } > OutTextXY(GetX-TextWidth(t[length(t)]),GetY,' '); > delete(t,length(t),1); ^----here > end; I had a similar problem, the only way that i could think to solve it was to rewrite the character in the background colour. Unfortunately this wont work if you don't know the background colour, or the colour varies from the start to end of the input string. The only other possability that i can think of is if you can XOR the original character onto the screen, and then XOR the character again to remove it from the screen. One further point that may speed up the program (a minute amount) would be to replace the delete(t,...) above with: t[0] := CHR(ORD(t[0]) - 1) as turbo just stores the length of a STRING in position 0. This is a useful hint if you need to use the LENGTH of a string a lot (just look at position 0 of the String) BUT unfortunately this is only in a character form (not a byte or integer) -- Trevor alias <****> tuo em tel esaelP ,lanimret siht edisni kcuts m`I pleH ( for all of you out there who can't read backwards..... Help i'm stuck inside this terminal, Please let me out )