Hi,
you were close To do what you need, you have to set cursor position first.
I created for you sample with simple wrapper function:
Uses "Console"
String sInput
sInput = Custom_InputAt("Enter your name please: ", 10, 10, %CONSOLE_FOREGROUND_GREEN)
Console_PrintAt("Your name is "+sInput, 10, 11)
sInput = Custom_InputAt("Enter your surname please: ", 10, 12, %CONSOLE_FOREGROUND_GREEN)
Console_PrintAt("Your surname is "+sInput, 10, 13)
WaitKey
Function Custom_InputAt( sPrompt As String, xPos As Long, yPos As Long, Optional lColor As Long) As String
Long oldTextAttribute
String sInput
' -- Did we passed color (4th param)?
If Function_NParams = 4 Then
' -- Retrieve old text attribute
oldTextAttribute = Console_GetTextAttribute()
' -- Set new color
Console_SetTextAttribute(lColor)
End If
' -- Print text at desired location
Console_PrintAt(sPrompt, xPos, yPos)
' -- Set cursor right after it
Console_SetCursorPosition(xPos+Len(sPrompt), yPos)
' -- Read the input
sInput = Console_ReadLine()
' -- Did we passed color (4th param)?
If Function_NParams = 4 Then
' -- Roll back old text attribute
Console_SetTextAttribute(oldTextAttribute)
End If
Return sInput
End Function
Petr
Bookmarks