Computer Science Canada

Changing position of text cursor.

Author:  Aziz [ Sat Jun 25, 2005 5:04 pm ]
Post subject:  Changing position of text cursor.

How would I go about changing the position of the text cursor (like a locate command in turing)

Author:  wtd [ Sat Jun 25, 2005 5:11 pm ]
Post subject: 

You don't. You print to the standard output, rather than a special window as in Turing. It's just linear text.

Why do you think you need this capability anyway? (What are you trying to accomplish?)

Author:  Aziz [ Sat Jun 25, 2005 5:26 pm ]
Post subject: 

Just input, but idiot-proof. So if they type in a string when the program needs an integer I go back to original line. But I get what you're saying Smile

Author:  [Gandalf] [ Sat Jun 25, 2005 5:44 pm ]
Post subject: 

I know very limited Java, but wouldn't you do that with a simple loop?
pseudocode:
loop
get input
if the input is an integer then continue the program
if the input is anything else then go back continue the loop

Author:  wtd [ Sat Jun 25, 2005 5:55 pm ]
Post subject: 

Yes, but I believe Aziz was trying to hide the original input.

Bad practice in a text UI environment. The ser knows they input that, so hiding it serves no purpose.

Author:  [Gandalf] [ Sat Jun 25, 2005 6:03 pm ]
Post subject: 

Ok, I agree, he still might want it for aesthetic (sp?) purposes, I don't know. Still, to do that wouldn't you just add a "clear the screen" to the loop?

Author:  wtd [ Sat Jun 25, 2005 6:10 pm ]
Post subject: 

[Gandalf] wrote:
Ok, I agree, he still might want it for aesthetic (sp?) purposes, I don't know. Still, to do that wouldn't you just add a "clear the screen" to the loop?


There's no portable way to do that. And not because no one has ever thought of doing it before. Wink


: