Jump to content

trying to find a way around a special INPUT and POSITION on the same line issue

Recommended Posts

So recently I found a little article on how to basically hide the "?" after an input statement, by using INPUT #16,N$  instead of a common INPUT N$. I thought this is cool. But here's a little puzzle I couldn't figure out, for when the POSITION statement comes into play and you are looking for 2 inputs to be entered on the same line. (Keep in mind that the reason I am wondering what I will be asking is because I have some inverse characters already printed in the location, and would like it to just be blank at that spot.)


For example, let's say you have a program where you are listing a friend's name and his age in a spreadsheet-like way.  The typical way we know:


3 PRINT CHR$(125)

5 DIM N$(10), A(2)



We all know we get:


? [name to input]         [and after return is pressed it shoots right over to.....]                       ? [age to input]



Now, with the new hide-the-question-mark command and concept, (more suitable to a chart I think) it would change to:


3 PRINT CHR$(125)

5 DIM N$(10), A(2)



That yields a cleared screen, initial cursor, then when typing begins, a quick movement to column 2, row 4 where you'd type a name but.... right after you press enter, the new concept is "ignored" or "aborted" , as the typical return is reinstated and occurs as going its usual down a line to the beginning of the next line, and then only shoots over to that 25,4 spot when you start typing the number.


I tried using semicolons but couldn't get anything to work with the INPUT #16,N$ concept thus far. 


So I guess what I am asking is..... is there a way to stop the cursor from going down to the beginning of that next line (where I have something else in that spot of the program) and instead have it remain on the same line (using INPUT #16,N$) and then it just shoots right over to the 25,4 location with no next line return?   Is there maybe some command/simulation to "hide" something, or print a blank cursor at the returned line spot, or use that in conjuction with the CHR$ command for carriage return... or at least some way to "fool" the computer that you can think of?  (Maybe something with blocking or redirecting say CHR$(155)?  ... all so that the computer can stay on that same line and not return yet, but still keeping the data in the string on all on the same line.  We need the computer to bypass the carriage return basically. Maybe nothing is possible, but I wondered if it is, somehow?






Edited by newTIboyRob
Link to comment
Share on other sites

Try this, using the keyboard for input, I think this is what you want or near to it.

Note the cursor does't move after a position until something is put/get from the screen, hence the ? " ";

and the position you set is one less so the cursor appears in the correct place for input


1 OPEN #1,4,0,"K:"
3 PRINT CHR$(125)
5 DIM N$(10),A(2)
10 POSITION 1,4:? " ";

20 IF K<>155 THEN ? CHR$(K);:N$(LEN(N$)+1)=CHR$(K):GOTO 15
50 ? "NAME=";N$;" AGE=";A
100 CLOSE #1

Edited by TGB1718
Link to comment
Share on other sites

Thanks for that TGB1718.   Wow, that was in fact sooo close!  Unfortunately though, that still puts a "?" at position 25,4  (and line 50 I wouldn't need as I would be just inputting consecutive things after this line is then entered:)


NAME:  JOHN                                                                                          ?AGE: (but with no preceding "?")  53  [enter]

(no print out here, just the next line down to continue the next NAME,         AGE:



...but I took yours and mine and made a combo. I first omitted line 50, and instead went back to make a change in line 30 now to:  30 POSITION 25,4:INPUT #16,A   Then I found that all you have to do is hit enter and then the space bar, so nothing appears at that location, and you do get to POSITION 25,4 where you can just type in the 53


... and there we have it! 


I would think this would be handy not just for me but for anyone who is trying to isolate specific spots on the screen via the POSITION command without the stinking question mark having to sit there!


Thanks for your knowledge and kindness in sharing these, once again. You consistently impress me my friend! :)

Edited by newTIboyRob
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

I am still playing with my original post above, trying to get 2 input sequences on the same line to stay on the same line after the first data is inputted. I realized I need to have 2 separate strings, (one alphanumeric and the other numeric only), so I can do a sum of the right hand column which will have numbers only. That being said, I might have asked these, but can you refresh my memory please as to if either one of these 2 things is possible:


1) Is there a way to change the "?" by assigning the cursor's block CHR$# to it instead, basically like a swap out or replacement or reassignment of the symbols, maybe through a POKE or small command series of lines? 

2) If the input statement's "?" would be at say, positions 3,5 then 25,5 on the same line, could the cursor's CHR$ symbol be put simply on top of the "?" essentially to hide it at those exact spots or something like "   "


I still like how I can get the 2 different strings on the same line with the POSITION command via the traditional INPUT A$ and INPUT A commands, but I still want that "?" to "disappear". (I don't want to use the OPEN K or the GET#, if I don't have to.)  I came the closest with the INPUT #16,A$ but that causes a line return after the first bit of data is inputted due to its needing an actual press of the enter key, when I am looking for the cursor to still stay on the same line and then jump over to the next position on the far right but still stay on that same line as it does with the traditional A$ and A input statements.


There's gotta be some clever way that you guys know I would think!



Edited by newTIboyRob
Link to comment
Share on other sites

You must mean #16, A$ like I mentioned (as it won't let me do it without the A$)... Yes, that way is cool, but the only thing is, when you use that for 2 inputs in the same line, you will get the line return, (which is what I've been trying to avoid so as to keep it on the same line),  and then its need for the space bar press, which will shoot you back up to the other position on that first line.


Try this, see if you come up with that too, or we can find a way around this?


3 PRINT CHR$(125)

5 DIM A$(10),B$(10)

10 POSITION 3,5:INPUT #16,A$

20 POSTION 25,5:INPUT #16,B$


Link to comment
Share on other sites

Maybe the closest I am going to get, unless I just "put up" with the "?", is a game of hide the cursor with this:


5 PRINT CHR$(125)

10 DIM A$(10),B$(10)

20 CHACT=755





It's a cool hide the cursor "ghostwriter" and allows 2 invisible spot inputs to be entered/stay on the same line.  The only drawback is that you can't have any other writing beforehand like the PRINT CHR$(160) cursor symbol.


Link to comment
Share on other sites

I assume the problem is the cursor appearing "newline" and not moving until you press a key.


I mentioned a fix in a previous post.

Before the INPUT - print something that's nondisplay.

From memory I used to get this problem in the day - ? CHR$(158) ;

is a good one - it's the "Clear TAB" sequence that doesn't display or show annoying cursor actions.

Link to comment
Share on other sites

Use POKE 752,1 to "hide" the block cursor:

10 POKE 752,1:? CHR$(125)
20 DIM A$(10),B$(10)
30 POSITION 3,5:INPUT #16,A$
40 POSITION 25,5:INPUT #16,B$

But that is insane!!!


I think that the best approach is to use the keyboard device as @TGB1718 said, like this:

10 POKE 752,1:? CHR$(125)
20 DIM A$(10),K$(80)
30 POSITION 3,5:GOSUB 70:A$=K$
50 POSITION 2,10:? "A$=";A$;" B=";B
60 END
70 OPEN #1,4,0,"K:":K$=""
71 ? "#";CHR$(30);:GET #1,K:IF K<>155 THEN PUT #16,K:K$(LEN(K$)+1)=CHR$(K):GOTO 71
72 ? " ";:CLOSE #1:RETURN

Of course, this subroutine at line 70 is very simple and does not manage backspace/delete. It requires K$ and K variables. Also, it does not guarantee that only digits are typed for B variable. Try pressing the arrow keys just for fun.


Replace the "#" at line 71 for whichever char you want, in normal or inverse video. Printing CHR$(30) just moves the real cursor over the fake one after it is printed. PUT #16,K is the same as ? CHR$(K); and ? is an abbreviation of PRINT. A semicolon at the end of a print statement is to keep the real cursor (visible or not) at that position instead of moving it to the next line.


Link to comment
Share on other sites

I use the keyboard, editor, and screen devices. I restrict input (including directional keys) by using ranges, allow backspace/delete, keep track of the length with a variable, and then build the string once return is pressed by reading the screen device where input was made.


  • Like 1
Link to comment
Share on other sites

3 hours ago, MrFish said:

I use the keyboard, editor, and screen devices. I restrict input (including directional keys) by using ranges, allow backspace/delete, keep track of the length with a variable, and then build the string once return is pressed by reading the screen device where input was made.

I forgot to add that, keeping track of the string length, I prevent the user from deleting beyond input characters, and also limit the max length of input. So, basically the user can only input characters (of whatever type needed), delete the characters, or hit return, and stays within the confines of a box for that.


  • Like 1
Link to comment
Share on other sites

Oh man, this was a really good post. @ Rybags, your last post is really what clinched it, and I was able to piece that together with your first post (where, though you didn't mention the specific CHR$(158); , but you mentioned the concept, and I didn't think of the 158;), ... and I was able to put it all together and made it work.                                                    So ding ding ding... we have a winner with the following, which does EXACTLY what I was looking for:


  • positioning use of exact screen positions
  • keeping everything all on the same line
  • allowing 2 inputs per line
  • and, though approaching Halloween, no ghosting of the cursor.


Wow, what a power punch, and extremely efficient, too, all in a simple 4 liner:


10 PRINT CHR$(125)





The above would be a great little sequence for combos of: name, occupation or name, age  etc.


Thanks to everyone. I am sure the above will help out others who maybe wanted something similar in anything they are/were writing too.


Edited by newTIboyRob
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...