FB3Group BKB |
HomeService and SupportManual
|
||||||
| |||||||
Tcl/Tk Interface
Tcl/Tk Interface
Tcl/Tk is a programming language that is used by uDraw(Graph)
for the realization of the user interface.
General information about Tcl/Tk is for example provided by the
uDraw(Graph) offers a Tcl/Tk interpreter that is accessible by the API. This interface can be used by application programmers to create their own application specific windows. The uDraw(Graph) Tcl/Tk interface is able to execute any Tcl/Tk 8.4 script in the same way as a "wish shell" (i.e. Tcl/Tk execution environment) can do. So the application program does not need to embed its own "wish shell" (or a separate Tcl/Tk interpreter) in order to use Tcl/Tk, because that function is offered by uDraw(Graph). This way the application does not need to deal with an additional toolkit to realize a graphical front-end. All it has to do to implement a graphical user interface is sending API commands with Tcl/Tk scripts to the API.
Tcl/Tk scripts can be sent either to uDraw(Graph) with API
command
A reasonable approach for using the Tcl/Tk interface is to save a script
of Tcl/Tk functions in a file and execute it with API command
The "uDrawGraph" command in Tcl/TkThe uDraw(Graph) Tcl/Tk interpreter that can be accessed by the API has all the features of a usual Tcl/Tk 8.4 interpreter (i.e. everything a "wish shell" can do), plus one additional object (or function) "uDrawGraph" that supports the two methods (or parameters) "tcl_answer" and "command", see below. The "uDrawGraph" Tcl object can be used in a Tcl/Tk script to send strings back to the application via the API or to send API commands directly to uDraw(Graph) from inside the script. Note: the user interface and graph visualization of uDraw(Graph) cannot be manipulated with the Tcl/Tk interface, so the "uDrawGraph" Tcl object does not offer the options you might expect. Precautions have been taken to avoid that the Tcl/Tk interface is misused to mesh with internal operations, disfigure dialog windows, etc. The only way to manipulate the uDraw(Graph) system is by communicating with the API. Security Restrictions in Socket Server Mode
When uDraw(Graph) acts as a socket server by using the command-line option
Tcl command "uDrawGraph tcl_answer <string>"
This Tcl command can be used in a Tcl/Tk script to send an arbitrary
string back to the application.
uDraw(Graph) will redirect parameter "string" via the API to the
application which will receive the answer
By sending this API command with a Tcl/Tk script to the uDraw(Graph) API, a window with a button "Hello" will appear. The API will send answer tcl_answer("Pressed") back to the application as soon as the user presses the button. Note: It is not possible to use the Tcl/Tk delimiters (i.e. "{" and "}") inside the string parameter of command "tcl_answer". So it is not allowed to use "...-command {uDrawGraph tcl_answer {Pressed}}" in the example above, although it is a valid Tcl/Tk expression. Tcl command "uDrawGraph command <api-command>"This Tcl command can be used in a Tcl/Tk script to send API commands directly to uDraw(Graph) without detour through the application. The result of the Tcl command in the Tcl/Tk script is the answer of the API command that was executed. So if the application has to be informed about the answer of the API command, then the Tcl/Tk script has to forward this result to the application using the Tcl command "uDrawGraph tcl_answer {...}".
By sending this API command with a Tcl/Tk script to the uDraw(Graph)
API, a window with a button "Clear" will appear.
After pressing this button, the API command
|
|||||||
|
|||||||