Terminal control/Restricted width positional input/No wrapping: Difference between revisions
Content added Content deleted
m (→{{header|Phix}}: syntax coloured, marked p2js incompatible) |
(Terminal control/Restricted width positional input/No wrapping in FreeBASIC) |
||
Line 36: | Line 36: | ||
(field-input-no-wrapping 2 4 8)</lang> |
(field-input-no-wrapping 2 4 8)</lang> |
||
=={{header|FreeBASIC}}== |
|||
<lang freebasic>Function getInput(fila As Integer, columna As Integer, ancho As Integer) As String |
|||
Locate fila, columna, 0 |
|||
Dim As String KBD, cadena = "" |
|||
Do |
|||
Do: KBD = Inkey: Loop Until KBD <> "" |
|||
If KBD = Chr(8) Then |
|||
cadena = Left(cadena, Len(cadena) - 1) |
|||
Print !"\b "; |
|||
Else |
|||
If Len(cadena) < ancho Then cadena &= KBD |
|||
End If |
|||
Locate fila, columna : Print cadena; |
|||
Loop Until KBD = Chr(13) |
|||
Return cadena |
|||
End Function |
|||
Dim As String s = getInput(3, 5, 8) |
|||
Locate 23,1 : Print "You entered: "; s |
|||
Sleep</lang> |
|||
=={{header|Go}}== |
=={{header|Go}}== |