It seems like there is less code that has to cover for the Linux Windows differences, but you now have external control over the port and BAUD rate selection. Again, this is a command line program. Since FBC creates a program icon, I tried to see if, in properties, you could add the parameters, but in Linux, it does not allow you to do that. The other option is to create a bash or bat file that will start the program with your parameters. Since the program contains the GUI code, when you start it in the command line, it will open up another window running the program.
Now I have to figure out what to do about the cursor control, should I create another terminal screen area, with a functional cursor. Which leads me to another thought. If I have another terminal screen area, is it possible to create a screen capture for a log file when needed? Then the next step, cut and paste, in the terminal screen area. Now I am really not sure if FBC can accomplish this.
My aim, a nifty, functional little serial terminal program that is written in FBC, is that possible?
Code: Select all
'cltest1.bas
' March 16, 2016
' Test for command line parameters
' For GUI desktop
Screen 12
Width 80,30
Dim As Integer i = 1
Dim As String arg1 = Command(1) ' Comm port
Dim As String arg2 = Command(2) ' BAUD rate
Dim As String Key,buffer
' Check for command line parameters
If arg1 = "" Then
print "Usage : SimTerm port baud"
Sleep 2000:Cls : Close : End
else
Open Com arg1 & ":" & arg2 & ",n,8,1,cs0,ds0,cd0,rs" As #1
End If
If Err Then
Print "Error opening ";arg1;
Sleep 2000 : Cls : Close : End ' Don't use GoTo !!!
Else
Print "Open Port: " & arg1 & " Baud: " & arg2
End If
Print "SimTerm, a simple Terminal Program. [Esc] to quit Program." _
' also X click !
'main serial send/receive routine
Do
Key = Inkey
If Key <> "" Then ' [Enter] is also sent ! (so, no check needed !)
Print #1,Key; 'Send the char
Print Key; 'This is the echo
End If
While Loc(1) > 0
buffer = Input(Loc(1),#1) 'Grab a char
Print buffer; : buffer = "" 'Print the char : clear Buffer
Wend
Sleep 10,1
Loop Until key = Chr(255,107) OrElse key = Chr(27)
Close: End