[Gambas-user] Embedded XTerm

Michael Asher asherlm at ...626...
Thu May 20 00:30:32 CEST 2010


To preface this, I'm not a developer by any stretch of the imagination

I'm looking to use the embedder class to embed a xterm into a form.

My main purpose for my project is to have something for managing my
SSH/telnet/serial sessions from a single application, similar to
SecureCRT or Putty.

Xterm allows me to specify the WM_CLASS item as it is opened (xterm
-class ...). I would like to provide a 'random' class value for each
xterm, should I get to the point where I have multiple forms/xterms,
etc.

I am able to launch the xterm, but the Desktop.FindWindow always
provides me with a zero count. Can I use a variable as the
"Application as String" portion in Desktop.FindWindow?

Below is from the module that is supposed to take the user input and
make the SSH or telnet connection. I've included the part that is
giving me issues.


Public Sub quickConnect_Click()
 Dim XtermClass As Integer
 Dim XTermClassStr As String
 Dim DoEmbedIntArray As Integer[]
 Dim DoEmbedInt As Integer
 Randomize 123 ' Not sure I need this, but it provides class name
consistency for now.

If chooseProtocol.Index = 1 Then
 XtermClass = Int(Rnd(10000, 100000))
 XTermClassStr = Str(XtermClass)

 Debug XtermClass
 Debug XTermClassStr
 Shell "xterm -class " & XtermClass & " -e ssh " & ipAddress.Text & "
-p " & choosePort.Text ' Provide XTERM with a CLASS Value so that we
can then find it and embed into the application.
 Wait 1
 Me.Delete
 DoEmbedIntArray = Desktop.FindWindow("", XTermClassStr, "")
 Debug DoEmbedIntArray.Count

Endif

If chooseProtocol.Index = 2 Then
 Shell "xterm -e telnet " & ipAddress.Text & ":" & choosePort.Text
 Me.Delete
Endif

End


I appreciate any pointers or help you can provide.
Thanks!
-Michael




More information about the User mailing list