Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 A Problem With The "Get" Command
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Amit




PostPosted: Fri Dec 19, 2008 4:33 pm   Post subject: A Problem With The "Get" Command

I'm having some trouble with the get command. Is there any way to get info from the user without moving down a line? I know for put you can do "Put <text> .." to stop it from moving to the next line, but is there any way to do this with get?
Sponsor
Sponsor
Sponsor
sponsor
dc116




PostPosted: Fri Dec 19, 2008 5:13 pm   Post subject: RE:A Problem With The "Get" Command

For example you can do this:

code:

var name : string
put "Please enter your name: "..
get name


As you can see, the get info is on the same line as the "Please enter your name"
Amit




PostPosted: Fri Dec 19, 2008 8:40 pm   Post subject: Re: RE:A Problem With The "Get" Command

dc116 @ Fri Dec 19, 2008 5:13 pm wrote:
For example you can do this:

code:

var name : string
put "Please enter your name: "..
get name


As you can see, the get info is on the same line as the "Please enter your name"


Mabye I wasn't clear enough. The code above is what I have, but when you press enter to input the data, Turing automatically moves the cursor down to the next line. I'm wondering if there is any way to keep the cursor on the same line.
andrew.




PostPosted: Fri Dec 19, 2008 9:12 pm   Post subject: RE:A Problem With The "Get" Command

I suppose you could do it with getch, but that would be a lot of work. You could get the information and then redraw the screen including the information.

e.g.
Turing:
var input : string
put "Enter something: " ..
get input
cls
put "Enter something: " + input + ". Okay."


Basically just clears the screen and writes everything together. That is the easiest way I can think of doing it. Look up getch if you want to do it another way.
Tyr_God_Of_War




PostPosted: Fri Dec 19, 2008 9:37 pm   Post subject: Re: RE:A Problem With The "Get" Command

locate! locate is the answer!

Turing:

var input : string
put "Enter something: " ..
get input

locate (Text.WhatRow - 1, length ("Enter something: " + input) + 1)

put "end"


Ha! It works! Wink

edit: You might want to use maxcol to make sure that everything lines up.
Amit




PostPosted: Fri Dec 19, 2008 10:38 pm   Post subject: Re: A Problem With The "Get" Command

I tried using locate, but since the text isn't always in the same place it would have involved much more work then I'm willing to expend on this project. I was hoping that there would be an easy way, but it doesn't seem like there is. Thanks anyway guys.
DanielG




PostPosted: Sat Dec 20, 2008 11:17 am   Post subject: RE:A Problem With The "Get" Command

the easiest way to fix it is to use getch to get characters until you get the enter key, basically, make your own get function
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 7 Posts ]
Jump to:   


Style:  
Search: