From: garfield@cs.tu-berlin.de (Sven Delmas)
Newsgroups: comp.lang.tcl
Subject: Re: xf tk/tcl -- need help on general usage
Date: 9 Nov 1992 12:57:41 GMT
Organization: Techn. Univ. Berlin (Germany)
NNTP-Posting-Host: desaster.cs.tu-berlin.de
In-reply-to: quandt@mcs213e.cs.umr.edu's message of 8 Nov 92 19:14:08 GMT
To: 

In article <1992Nov8.191408.3561@umr.edu> quandt@mcs213e.cs.umr.edu (Brian Quandt) writes:

   I'm trying to figure out the general theory in use for
   xf, tk and tcl.

   Having read the papers on tk and tcl and most of the FAQ's I still
   don't quite understand.

   This is what I so far envision:
	   Create a GUI using xf in conjunction with tk/tcl.  

	   Then build the application the normal way.  That is, I build up
   everything that is not the GUI (e.g., database routines, math
   functions, etc) using C and compile the code into an executable.  
Tcl/Tk is an embeddable extension language. This means it is part of
your application (binary). The only way to not include Tcl/Tk would be
to use a non Tcl/Tk comunication facility (like TCP) to implement an
abstract protocol for the communication between the GUI (Tcl/Tk) and a
application not containing Tcl/Tk.

   Now how do I get the binary to communicate with the GUI?  
The usual way to "communicate" is that the c-functions are implemented
as part of the Tcl/Tk interpreter (wish). This means you create a Tcl
interpreter (binray) that contains your additional c-functions in
a way that they can be called from the Tcl-script (Tcl_CreateCommand).
It is also possible to call Tcl-code from your c-functions, giving you
full access to Tcl/Tk (Tcl_Eval).

   Since xf (and tcl) is a script file this runs in a shell (interpreted 
   environment).  I just don't follow the basic concept of how 
   to get 2-way communication between the script GUI and the binary
   application.  I understand that I could write the GUI using 
   embedded tk (in C).  But this loses many of the advantages that
   a seperate GUI and application can provide, not to mention the
   advantages of building a GUI in a interpreted environment.  In
   the tk paper the author talked about the 'send' command as the
   means to communicate.  I don't see how to establish a communication
   to the application code.   I see how a link could be made to another
   tk/tcl script, but not a binary. Finally, once I figure out the
   basic concept of how to communicate I'm wondering about sending
   large amounts of data via whatever the mechanism is used to
   communicate. For example, say that I have a GUI that calls up
   images stored in a database.  How should I 'pass' this information
   from the appliatino (c code) to the GUI?
Passing binary data via 'send' may lead into trouble. The passed data
must follow the Tcl syntax, because the data you send is interpreted
by Tcl. In that case I would suggest not to separate GUI and
c-functions (GUI independant code), or to use a different
communication facility (like TCP).


						   Thanks in advance
						   Brian Quandt

Sven
--
garfield@cs.tu-berlin.de
--
----
  Sven Delmas (Techn. Univ. Berlin)
    garfield@cs.tu-berlin.de
----
  For every problem there is a solution which is simple, clean and wrong.
                                                  Henry Louis Mencken
Newsgroups: comp.lang.tcl