Terminal Windows in Main-Form

Post

Posted
Rating:
#1 (In Topic #474)
Avatar
Trainee
Hallo,

because I need a terminal window for running a command, I would like to ask,
how can I integrate this into a form-tool f.e. like text.aera? Appreciate to hear
from you!


Gamba_Dance
Online now: No Back to the top

Post

Posted
Rating:
#2
Guru
BruceSteers is in the usergroup ‘Guru’
 TerminalView is the best component to have an interactive terminal.

Shell output from the Shell or Exec command can be directed to a text area like…

Shell 'ls/home' To TextArea1.Text

Also you can
Shell 'command" For Input Output

And set up a Process_Read() event handler.
Info on how to do this is on the gambas wiki shell help.
Online now: No Back to the top

Post

Posted
Rating:
#3
Guru
BruceSteers is in the usergroup ‘Guru’
Sorry my last reply was brief as i was at work.

So…
If all you want is to see the output of a shell command and not type anything then it's very simple.

There are 2 ways.
Simply use the Shell or Exec command using the "To" keyword to direct the output straight to the TextArea object like this…


Code (gambas)

  1. Shell "ls /home" To TextArea1.text
  2.  
Or…

Code (gambas)

  1. Exec ["ls", "/home"] To TextArea1.text
  2.  

Another way is to set up a Read event handler that monitors for read events.
using the As keyword to assign events to a name. (in this case the name "Process")
Like this…

Code (gambas)

  1. Public Sub Process_Read()
  2.   Dim sLine As String
  3.   Read #Last, sLine, -256
  4.   TextArea1.Text &= sLine
  5.   TextArea1.Pos = Len(TextArea1.Text)
  6.   TextArea1.EnsureVisible
  7.  
  8. Public Sub RunCommand()
  9. Shell "ls /home" For Input Output As "Process"
  10.  

Or do you need something more advanced?
Online now: No Back to the top

Post

Posted
Rating:
#4
Avatar
Guru
cogier is in the usergroup ‘Guru’
Hi Gamba_Dance and welcome to the forum.

BruceSteers is right in what he says but if you do need an example I wrote a program with a Terminal in 7 lines of code that is on the Gambas Farm or available here. There are other examples on the Farm as well.

If you give us a bit more detail of what you are trying to do we could offer better advice.
Online now: No Back to the top

Post

Posted
Rating:
#5
Avatar
Trainee
 Hallo together and thank you very much, for your quick an friendly help.
I think your solutions will fetch my problem. Because I didn't find any
chat-code for Gambas, I wanna integrate a terminal-window with a chat-function,
for using in LAN intranet.

Gamba_Dance
Online now: No Back to the top
1 guest and 0 members have just viewed this.