Locate

BlitzPlus Forums/BlitzPlus Programming/Locate

Ash_UK(Posted 2005) [#1]
I am having a problem. I am trying to port some code into BlitzPlus and i have a line of code that looks like this:

locate 10,10
name = input("Please enter your name")

This would allow me to position the input field anywhere on the screen. So i could ask the user for their name at the bottom middle of the screen for example.
The problem i have now, is when i try to port this code over to Blitz Plus, it doesn't recognise the locate command. So now i can't position the input field.
If someone could help me out here, i would be very grateful.

Thanks


CS_TBL(Posted 2005) [#2]
Why don't you use a true gadget for that? That's kinda the purpose of B+ eh!..

CreateTextField or CreateTextArea will do as foolproof inputroutine.


Ash_UK(Posted 2005) [#3]
Hmmm, it's a game i'm doing though, not an application. Would it still work or would i need to adapt a different approach?


CS_TBL(Posted 2005) [#4]
spit out more info on the game then, to form an opinion on what will be a suitable solution..

I can't imagine you want a console screen with a simplish nonfoolproof input routine to be a part of a game as well.


Phoenix(Posted 2005) [#5]
It's eay to make your own, here's an example, it's not flawless, but you get the idea.

Function Input$(x,y,frequency = 350)
	Local milli = MilliSecs()

	While Not KeyHit(28)
		If milli-MilliSecs()<=-frequency Then blink = 1 - blink : milli = MilliSecs()

		key = GetKey()
		
		If key>33 Then ReturnString$ = ReturnString$ + Chr(key)

		Text x,y,ReturnString$
		If blink Then Rect x+StringWidth(ReturnString$),y,5,StringHeight(ReturnString$)
		
		Flip
		Cls
	Wend
	
	Return ReturnString$
End Function

Input(x,y)



Ash_UK(Posted 2005) [#6]
Cheers Pheonix :)
Sorry CS, it is for a single screen, turn based game where you enter details at the bottom of the screen. Its an education sort of game for children :)