Board index » delphi » cursor position goes nuts, what the heck?
Flare
![]() Delphi Developer |
Fri, 16 Nov 2001 03:00:00 GMT
|
Flare
![]() Delphi Developer |
Fri, 16 Nov 2001 03:00:00 GMT
cursor position goes nuts, what the heck?
I have a program where a specific time is supposed to be written out to a
specific location. This write is in a repeat..until loop, and it is performed several (9) times (the write, not the loop). What occurs is a blinking cursor that jumps around after every write, moving to different (unrelated) portions of the screen. Is there a way to make the cursor disappear? By cursor I mean the little white " _ ". Can this be solved using the TextColor procedure from the CRT unit? I have tried doing that, with no success! Can anyone help me? -Fare PS. If you need source code, let me know. |
Ingmar Tulv
![]() Delphi Developer |
Fri, 16 Nov 2001 03:00:00 GMT
Re:cursor position goes nuts, what the heck?In article <01beab62$81cd1b40$3c83ebd1@bryvkin>, "Flare" <bob3...@aol.com> wrote: Quote> I have a program where a specific time is supposed to be written out There is no way to do it hi-level, at least with BP/TP. You have to use -- Sent via Deja.com http://www.deja.com/ |
Gero Kunt
![]() Delphi Developer |
Fri, 16 Nov 2001 03:00:00 GMT
Re:cursor position goes nuts, what the heck?QuoteFlare (bob3...@aol.com) wrote: Quote> Death to the little white Cursor! right? It is possibly one of the Frequently Asked Questions, but since I've never read the TP FAQ file, I don't know for sure. I'll provide you with a simple, but maybe useful solution. It's more something like a hack, because you don't really turn off the cursor, but simply hide it: Before you make your screen output, insert TextColor (0); TextBackGround (0); into your code. Then, change the text colour back to the setting you want. The text screen cursor always appears in the colour of the text cell it is This method, however, will not work if your output reaches the last rows, Cheers, Gero --------------------------------------------------------------------------- |
Assassi
![]() Delphi Developer |
Fri, 16 Nov 2001 03:00:00 GMT
Re:cursor position goes nuts, what the heck?maybe there's a pascal call, but i just use the BIOS interrupts. this program will turn off the cursor and then return it to the (typical) default cursor before finishing: ----- begin actually, you'd want to use int 10h/AH=3 to read the current cursor -Assassin assas...@reality.yps.org =-= Join us in the fight against {*word*267}! =-= QuoteFlare <bob3...@aol.com> wrote: : specific location. : This write is in a repeat..until loop, and it is performed several (9) : times (the write, not the loop). : What occurs is a blinking cursor that jumps around after every write, : moving to different (unrelated) portions of the screen. Is there a way to : make the cursor disappear? By cursor I mean the little white " _ ". Can : this be solved using the TextColor procedure from the CRT unit? I have : tried doing that, with no success! : Can anyone help me? : -Fare : PS. If you need source code, let me know. |
Dr John Stockto
![]() Delphi Developer |
Fri, 16 Nov 2001 03:00:00 GMT
Re:cursor position goes nuts, what the heck?JRS: In article <7iucck$em...@surz18.HRZ.Uni-Marburg.DE> of Mon, 31 May 1999 16:12:04 in news:comp.lang.pascal.misc, Gero Kunter Quote<kun...@mathematik.uni-marburg.de> wrote: unsatisfactory answer. See TSFAQP #21, via sig. The matter is also discussed in my http://www.merlyn.demon.co.uk/pascal.htm. At least one utility program does not reset the screen attributes of Mind you, it seems from the description of the original problem that the -- |
Gero Kunt
![]() Delphi Developer |
Sat, 17 Nov 2001 03:00:00 GMT
Re:cursor position goes nuts, what the heck?Dr John Stockton (j...@merlyn.demon.co.uk) wrote: Quote> JRS: In article <7iucck$em...@surz18.HRZ.Uni-Marburg.DE> of Mon, 31 May solution does exactly that. It is not the "clean" version (via the BIOS), but since the original poster has stated in a different thread that he is only 14 years old and not used to using pointers and direct memory access I thought it might be useful to show him a way how to solve that problem without using concepts he doesn't understand yet. That's why I gave him the explanation of what these two, three lines of code do. Quote> At least one utility program does not reset the screen attributes of poster is using. Cheers, Gero --------------------------------------------------------------------------- |
Pedt Scrag
![]() Delphi Developer |
Sat, 17 Nov 2001 03:00:00 GMT
Re:cursor position goes nuts, what the heck?Gero Kunter used chalk and slate for Quote>Dr John Stockton (j...@merlyn.demon.co.uk) wrote: Using your solution on some programs here generates a screen that, at Quote> The solution offered by me does definitely work with FPC, the compiler the ISTM that Dr. John, in another post, has hit the nail on the head with: Quote>JRS: In article <7iucck$em...@surz18.HRZ.Uni-Marburg.DE> of Mon, 31 May Post your problematic code here (just the bits where the cursor seems to -- Never curse the Crocodile's mother before crossing the river |
Flar
![]() Delphi Developer |
Sat, 17 Nov 2001 03:00:00 GMT
Re:cursor position goes nuts, what the heck?Yes, I am 14, and thank you all for the help. I also use the FPK-Pascal compiler (is that FPC?). However, the mystery behind the jumping around of the cursor was not solved, rather bypassed. I assume that Pascal has no problems with characters being written to portions of the screen that already have text, and that computations do not make the cursor go nuts.... Dutifully misspelling my own name in previous posts, Flare <bob3...@aol.com> wrote in article Quote> I have a program where a specific time is supposed to be written out to a |
Pedt Scrag
![]() Delphi Developer |
Sat, 17 Nov 2001 03:00:00 GMT
Re:cursor position goes nuts, what the heck?Flare used chalk and slate for Quote> I assume that Pascal has no the relevant fragment may help to solve the problem. It does sound like you have some stray GotoXY statements in the code. -- Pedt Never curse the Crocodile's mother before crossing the river |
Gero Kunt
![]() Delphi Developer |
Sun, 18 Nov 2001 03:00:00 GMT
Re:cursor position goes nuts, what the heck?First of all, I would like to make something clear: I do know that my solution is not "by the book". It is, as I said in my original answer, "more like a hack". But - it also does work, and is very simple. I thought that the problem of the original poster was that he wanted to make the cursor disappear. I didn't pay too much attention to his description of "a jumpy cursor", because I thought it was just a description of the general cursor movement. If the poster's main problem is, in fact, a text cursor which moves erratically and unpredictable, then my answer was indeed quite "unsatisfactory". QuotePedt Scragg (newsmas...@pedt.demon.co.uk) wrote: Quote> Using interrupts is not pointer or direct memory access. as using pointers or direct memory access. Quote> Using your solution on some programs here generates a screen that, at after program termination. If the last output is not important, you would just clear the screen at the end of the program with a visible colour. Quote> > The solution offered by me does definitely work with FPC, the compiler And please - don't take offence by my first posting! I didn't want to Cheers, Gero --------------------------------------------------------------------------- |
Flar
![]() Delphi Developer |
Sun, 18 Nov 2001 03:00:00 GMT
Re:cursor position goes nuts, what the heck?The offending code resembles this: repeat GetTime(v, w, z2, z3); red; If z2 = z then begin GoToXY(3,3); write('9'); end; If z2 > z then begin GoToXY(3,3); write(9 - (z2 - z)); z2 := z2 + 1; GoToXY(79,23); end; If (9 - (z2 - z)) = -1 then begin GoToXY(3,3); write('0'); timeup := true; end; until (keypressed) or (timeup = true); sorry about the indentation, but it is a part of a different program... this is NOT the optimal code for this situation, but I do not think that |
Pedt Scrag
![]() Delphi Developer |
Sun, 18 Nov 2001 03:00:00 GMT
Re:cursor position goes nuts, what the heck?Flare used chalk and slate for Quote>The offending code resembles this: You'll probably want to look for any GotoXY statements in this procedure that are not required as you said you are getting multiple jumps. <snip> Quote> z2 := z2 + 1; This is the line to delete to solve your jumping problem in this part of The remaining code just moves the cursor back and forth to 3,3 and the -- If smoking is so bad for you, how come it cures kippers?! |