Input command
Blitz3D Forums/Blitz3D Beginners Area/Input command
| ||
was wondering how do you get it to input on the same line. e.g. a=input(" type in a number") b=input(" type in a number") how do you get it so that when they have entered in a value for a, the next prompt is on the same line and so you don't see the first prompt? i.e. the cursor keeps moving down the screen normally how do you prevent this so that the inputs happen on the same x,y positions ?? thanks, SD |
| ||
Locate 0,0 a = Input("Type a number: ") Cls Locate 0,0 b = Input("Type another number: ") |
| ||
thanks GFK ! :) |
| ||
Actually, if you want to do a bit more work, you can use a string for the question asked, which helps you determine where the tail end would appear on the screen, then collect the entered value as a string, and using the length of the two strings together, determine where the next-field-over position would be in that same line, or if you have space left on the line to have another field. Like so:r=0 ;r represents the current row, increment by 12 c=0 ;c represents the current col, increment by 8 a$="Type a Number: " locate r,c n1$=input(a$) c=c+(len(a$)+len(n1$)+2)*8 locate r,c a$="Type another number: " n2$=input(a$) c=c+(len(a$)+len(n2$)+2)*8 locate r,c Note the redundant pattern that appears here. Add a check to see when you reach or exceed far right of the screen, (or more neatly, just get too close), which would then cause you to increment r=r+12 and set c=0 again, and you can progress in form fashion from the top across the screen and down, with lots of information obtained in this manner. And instead of using a$, n1$ and n2$, you might use a$(index) n$(index) as part of tracking the questions and answers in an array, and then instead of using r and c, you could use r(index) and c(index), which would allow you to return to any question and answer on the screen, then you could control all that with you cursor keys, and suddenly you have a method of having people complete forms, even with the ability to go back and make changes. Interesting, eh? |
| ||
Show off. |
| ||
lol ~ thanks guys ! :) |
| ||
Hmmm. I had wanted to mention something else as well. Blitz appears to us an ORing method of writing text to a graphical screen. That means one character overlays another it you write to the same area. This can be neat for certain special effects or creating multiple-character shapes, but it can be awkeard to erase a previous character and write a new one in it's stead. You can wes the ViewPort statement to define a small rectangle immediately surrounding the character space, then use the CLS command to clear just that area. The r.c coordinates used above tell you basically where the area is. but it is up to you to gauge the height and width of each character and to determine where a given character's position lies. But if you want to program, this is the sort of challenge you have to undertake. of course after you use the CLS, you would use ViewPort command again to set the normal "view" to the full screen - or at least to the area where you intend to let the user enter more data. Oh, as to the comment a couple of entries up, what would you consider to be the better response: Pithy, or Jealous? |