1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
|
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) 2006 - INRIA - Allan CORNET
*
* This file must be used under the terms of the CeCILL.
* This source file is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at
* http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
*
-->
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="TCL_EvalFile">
<refnamediv>
<refname>TCL_EvalFile</refname>
<refpurpose>Reads and evaluate a tcl/tk
file
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Calling Sequence</title>
<synopsis>TCL_EvalFile(filename [,interp])</synopsis>
</refsynopsisdiv>
<refsection>
<title>Arguments</title>
<variablelist>
<varlistentry>
<term>filename</term>
<listitem>
<para>character string. Contains the name of the file to read and
evaluate.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>interp</term>
<listitem>
<para>optional character string parameter. Name of the slave tcl
interpreter in which the operation has to be performed. If not
provided, it defaults to the main tcl interpreter created by
Scilab.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsection>
<refsection>
<title>Description</title>
<para>With this routine, one can read and evaluate the content of a file
containing tcl/tk scripts. This allows to create powerful tk
interfaces.
</para>
<para>The filename might be relative or absolute.</para>
</refsection>
<refsection>
<title>Advantages and drawbacks of this functionality</title>
<para>This routines allows to use directly tcl/tk scripts. This thus allows,
for instance to use Interface Builders such as SpecTcl to design the
interface. The interfaces built directly with tcl/tk scripts are much
faster than the ones built with the Scilab Graphic Object library provided
with tksci (see uicontrol for example). Indeed, those Objects are warpings
around tk graphic widgets. Nevertheless, this way of creating graphic user
interface should only be used when one aims at addressing directly
specific tk/tcl features. There are two main reasons for this. First of
all, there is no simple way to manipulate Scilab objects from within a
tcl/tk script. Thus, the interface designer has to write two sets of
callbacks routines. One to describe the changes occuring in the interface
when the user acts on the widgets. The second set of call routines will
perform the (pure) Scilab reactions to the user actions.
</para>
<para>Here is an example: Suppose you design a scrollbar corresponding to a
spline tension value. You want the spline to be displayed in a graphic
windows and updated each time the user moves the scrollbar. At the same
time, you want the value of this tension parameter to be displayed within
the Interface. You will have to write a first tcl/tk (callback) function
which will be automatically called by the tk scrollbar ("-command"
option). This callback function will update the displayed value of the
parameter in the interface and will then call the scilab routine
("ScilabEval" command) to update the graph.
</para>
</refsection>
<refsection>
<title>Remarks on the tcl/tk script style</title>
<para>Because Scilab manages the tcl/tk events, it creates the root window
".", this window should not be destroyed nor directly used by your tcl/tk
scripts. You should thus always create your own toplevel windows.
Moreover, since this module was written at a time when namespaces didn't
exist, some variables defined by scilab tcl/tk scripts could collide your
code. Running your scripts in a slave interpreter may help in such a
case.
</para>
<para>
More information about Tcl/Tk: <ulink url="http://www.tcl.tk/doc/">http://www.tcl.tk/doc/</ulink>
</para>
</refsection>
<refsection>
<title>Examples</title>
<programlisting role="example"><![CDATA[
TCL_EvalFile(SCI+"/modules/tclsci/demos/tk/puzzle");
]]></programlisting>
</refsection>
<refsection role="see also">
<title>See Also</title>
<simplelist type="inline">
<member>
<link linkend="ScilabEval">ScilabEval</link>
</member>
<member>
<link linkend="TCL_EvalStr">TCL_EvalStr</link>
</member>
<member>
<link linkend="TCL_GetVar">TCL_GetVar</link>
</member>
<member>
<link linkend="TCL_SetVar">TCL_SetVar</link>
</member>
<member>
<link linkend="TCL_ExistVar">TCL_ExistVar</link>
</member>
<member>
<link linkend="TCL_UnsetVar">TCL_UnsetVar</link>
</member>
<member>
<link linkend="TCL_UpVar">TCL_UpVar</link>
</member>
</simplelist>
</refsection>
</refentry>
|