Is there existing an inputroutine?
Is there existing an inputroutine?
An input routine for to get data.
I wrote severals, but it is not easy. I mean one whit the
input arguments locate, length, color. And keys ASCII,
backspace, Arrow left and right.
Maybe knows someone a right one.
I wrote severals, but it is not easy. I mean one whit the
input arguments locate, length, color. And keys ASCII,
backspace, Arrow left and right.
Maybe knows someone a right one.
Re: Is there existing an inputroutine?
Since I don't really understand your question, can you provide some code,
which highlights the problem, you are having?
See also: FB-Manual/Input
which highlights the problem, you are having?
See also: FB-Manual/Input
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Re: Is there existing an inputroutine?
@MrSwiss he means an input field a one row edit box you know ?
I saw one or two solutions in the past ... must do a forum search :-(
Joshy
I saw one or two solutions in the past ... must do a forum search :-(
Joshy
Re: Is there existing an inputroutine?
@Joshy, thanks.
@Jawade,
which OS are you using? (WIN/LIN/other, please specify)
Console or Graphics (GUI)?
@Jawade,
which OS are you using? (WIN/LIN/other, please specify)
Console or Graphics (GUI)?
Re: Is there existing an inputroutine?
I use Windows 10. And I mean an input routine who can give the program
several data, like usename, password and so on. I want one who well wil
ppassed in in a existing program. I wrote one wich have only the Backspace
key, and I don't get it better.
several data, like usename, password and so on. I want one who well wil
ppassed in in a existing program. I wrote one wich have only the Backspace
key, and I don't get it better.
Re: Is there existing an inputroutine?
Well, in console mode, there is not much more, that can be done.Jawade wrote:I wrote one wich have only the Backspace key, and I don't get it better.
In GUI mode, you could use a existing library, like WinGUI which has a Edit-Control.
Some Edit... Functions (essentially the same, just returning different variable types).
You can call them, as many times as needed:
Code: Select all
Function EditStr( _ ' console only Edit-Control
ByVal row As UByte = 1, _ ' row position
ByVal col As UByte = 1, _ ' column pos.
ByVal txt As String = "", _ ' user message (if any)
ByVal f_c As UByte = 7, _ ' foreground color
ByVal b_c As UByte = 0 _ ' background color
) As String ' return a string
Dim As String tmp = ""
Color(f_c, b_c) : Locate(row, col)
Line Input txt + ": ", tmp
Color(7, 0) : Return tmp
End Function
Function EditLng( _ ' console only Edit-Control
ByVal row As UByte = 1, _ ' row position
ByVal col As UByte = 1, _ ' column pos.
ByVal txt As String = "", _ ' user message (if any)
ByVal f_c As UByte = 7, _ ' foreground color
ByVal b_c As UByte = 0 _ ' background color
) As Long ' return a number
Dim As String tmp = ""
Color(f_c, b_c) : Locate(row, col)
Line Input txt + ": ", tmp
Color(7, 0) : Return CLng(tmp)
End Function
Function EditDbl( _ ' console only Edit-Control
ByVal row As UByte = 1, _ ' row position
ByVal col As UByte = 1, _ ' column pos.
ByVal txt As String = "", _ ' user message (if any)
ByVal f_c As UByte = 7, _ ' foreground color
ByVal b_c As UByte = 0 _ ' background color
) As Double ' return a float number
Dim As String tmp = ""
Color(f_c, b_c) : Locate(row, col)
Line Input txt + ": ", tmp
Color(7, 0) : Return Val(tmp)
End Function
Locate(2, 2) : Print "Press [ENTER] to finish input."
Dim As String s = EditStr(5, 2,"input test", 14)
Cls
Locate(2, 1) : Print "Edit return: *"; s; "* (without the *)"
Locate(6, 1) : Print "press a key to EXIT ";
sleep
Re: Is there existing an inputroutine?
Thanks, it is very nice. Works also in graphics.
Re: Is there existing an inputroutine?
You may also want to check InputUsing code with advanced OMIKRON BASIC syntax:
https://www.freebasic-portal.de/code-be ... e-257.html
https://www.freebasic-portal.de/code-be ... e-257.html
Re: Is there existing an inputroutine?
Thanks, looks very goood.
Now I look for a routine who prints everything. Because I use a printroutine
who is scalable.
Now I look for a routine who prints everything. Because I use a printroutine
who is scalable.
Re: Is there existing an inputroutine?
There are several kinds of devices one can print to.Jawade wrote:Thanks, looks very goood.
Now I look for a routine who prints everything. Because I use a printroutine
who is scalable.
Re: Is there existing an inputroutine?
Omikron Basic, really? Wasn't that the Atari ST Basic for a short period? I have tinkered with it, but then Gfa took over.TJF wrote:You may also want to check InputUsing code with advanced OMIKRON BASIC syntax:
https://www.freebasic-portal.de/code-be ... e-257.html
Re input routine, see this thread. Works fine but the way FB treats external DLLs is a bit awkward. That routine allows a prompt and a prefilled string, like this:
Code: Select all
MyString=GETINPUT("What's your hobby? ", "programming in Basic")
Re: Is there existing an inputroutine?
It was vice versa: Atari started with Gfa and then the powerful OMIKRON took over.jj2007 wrote:Wasn't that the Atari ST Basic for a short period? I have tinkered with it, but then Gfa took over.
-
- Posts: 862
- Joined: May 05, 2015 5:35
- Location: Germany
Re: Is there existing an inputroutine?
Dynamic input (in a loop)
Code: Select all
Sub _input(st As String,message As String)
Dim As String i=""
Static As long k=1
Static As String j,blink
static as double t
i=Inkey
If Left(i,1)=Chr(08) Then j=Mid(j,1,Len(j)-1)
Select Case Left(i,1)
Case Chr(0) To Chr(254)
If Left(i,1)<>Chr(08) Then
j=j+Left(i,1)
End If
End Select
if timer-t>.5 then
t=timer
k=-k
if k=1 Then blink=" " else blink="_"
end if
If Left(i,1)=Chr(27) Then j=""
If i<>Chr(13) Then
Print st & j & blink
Else
j=Rtrim(j,Chr(13))
message=j
j=""
End If
End Sub
Function framecounter() As long
dim as double t2=timer
Static As Double t3,frames,answer
frames=frames+1
If (t2-t3)>=1 Then
t3=t2
answer=frames
frames=0
End If
Return answer
End Function
dim as string msg
do
cls
locate 1,,0
print "fPS ";framecounter
locate 3,,0
_input("Enter stuff (q to quit) ",msg)
locate 7,,0
print msg
sleep 20,1
loop until msg="q"
Re: Is there existing an inputroutine?
Yes, that one is brilliant. Thanks for reminding us!grindstone wrote:In all modesty:
https://freebasic.net/forum/viewtopic.p ... 48#p250621
@TJF:
I used Gfa on the Atari ST until roughly 1996, then my work hierarchy forced me to switch to Windows. And there I continued with Gfa until they introduced 64-bit Windows versions. But I can still run my 16-bit Windows stuff in a VM, and my old Atari programs run just fine in the Steem emulator. And today, I use Gfa syntax in Win7 and Win10, see here ;-)TJF wrote:It was vice versa: Atari started with Gfa and then the powerful OMIKRON took over.jj2007 wrote:Wasn't that the Atari ST Basic for a short period? I have tinkered with it, but then Gfa took over.