1 |
578 |
markom |
===============================
|
2 |
|
|
Stand-alone Tix Applications
|
3 |
|
|
================================
|
4 |
|
|
|
5 |
|
|
INTRODUCTION
|
6 |
|
|
|
7 |
|
|
Traditionally, Tcl/Tk and its extensions require an extensive set of
|
8 |
|
|
run-time scripts. These scripts are usually stored as
|
9 |
|
|
/usr/local/lib//*.tcl. When a Tcl/Tk executable starts up,
|
10 |
|
|
it looks for the scripts in the /usr/local directory, or as defined
|
11 |
|
|
by enviornment variables such as TCL_LIBRARY or TIX_LIBRARY.
|
12 |
|
|
|
13 |
|
|
The need of an external script library sometimes causes problems
|
14 |
|
|
because users may need to keep track of their TCL_LIBRARY environment
|
15 |
|
|
variables. Also, it is quite difficult to distribute a Tcl
|
16 |
|
|
executable to a customer's site if the customer's machines don't
|
17 |
|
|
already have Tcl installed.
|
18 |
|
|
|
19 |
|
|
One solution of this problem is to compile stand-alone versions
|
20 |
|
|
Tcl/Tk application. The scripts can be compiled into into the
|
21 |
|
|
application executable, or into shared libraries which are linked
|
22 |
|
|
into the executable. The distrution of a monolithic executable, or
|
23 |
|
|
one executable with several shared libraries, is substantially
|
24 |
|
|
easier than the distribution of many Tcl scripts scattered around in
|
25 |
|
|
differenr directories.
|
26 |
|
|
|
27 |
|
|
COMPILING STAND-ALONE TIX
|
28 |
|
|
|
29 |
|
|
Currently Tix supports standalone modules only for Tcl version 7.5
|
30 |
|
|
and 7.6 on Unix. Read the file docs/UnixInst.html first before
|
31 |
|
|
reading the rest of this section.
|
32 |
|
|
|
33 |
|
|
To exable Tix stand-alone module, change into a Unix build directory
|
34 |
|
|
and run the configure script with the --enable-sam option. Then, run
|
35 |
|
|
"make". When "make" finishes, you will get several libraries and
|
36 |
|
|
executables (the names may vary depending on the version of Tcl and
|
37 |
|
|
the Unix platform):
|
38 |
|
|
|
39 |
|
|
libtix4.1.7.6.so Standard Tix shared library.
|
40 |
|
|
tixwish Standard Tix shell.
|
41 |
|
|
|
42 |
|
|
libtixsam4.1.7.6.so Tix SAM library.
|
43 |
|
|
libtksam4.2.so Tk Sam library.
|
44 |
|
|
libtclsam7.6.so Tcl Sam library.
|
45 |
|
|
satixwish Stand-alone Tix shell
|
46 |
|
|
sawish Stand-alone Tk shell
|
47 |
|
|
satclsh Stand-alone Tcl shell
|
48 |
|
|
|
49 |
|
|
|
50 |
|
|
DISTRIBUTING satixwish
|
51 |
|
|
|
52 |
|
|
satixwish is linked to the following libraries
|
53 |
|
|
libtixsam Tix c code and scripts
|
54 |
|
|
libtksam Tk scripts.
|
55 |
|
|
libtk Tk c code
|
56 |
|
|
libtclsam Tcl scripts
|
57 |
|
|
libtcl Tcl c code.
|
58 |
|
|
|
59 |
|
|
If you would like to distribute satixwish, you should include the
|
60 |
|
|
satixwish executable, the five shared libraries and your
|
61 |
|
|
application's Tcl scripts. There is no need to include the Tcl, Tk
|
62 |
|
|
and Tix script libraries.
|
63 |
|
|
|
64 |
|
|
DYNAMICALLY LOADING TIX SAM
|
65 |
|
|
|
66 |
|
|
You can also dynamically load libtixsam into a running wish. If you
|
67 |
|
|
have properly installed Tix, you can execute the command
|
68 |
|
|
|
69 |
|
|
package require -exact Tixsam [tixBinVer 4.1]
|
70 |
|
|
|
71 |
|
|
If Tix has not been installed in your system, you can still use the
|
72 |
|
|
"load" command to dynamically load Tixsam:
|
73 |
|
|
|
74 |
|
|
load [file join $dir \
|
75 |
|
|
libtixsam[tixBinVer 4.1][info sharedlibextension]] \
|
76 |
|
|
Tixsam
|
77 |
|
|
|
78 |
|
|
See the file docs/Pkg.txt for discussions on the tixBinVer
|
79 |
|
|
procedure and dynamic loading of Tix.
|
80 |
|
|
|
81 |
|
|
USING TIX WITH EMBEDDED TK
|
82 |
|
|
|
83 |
|
|
Embedded Tk (ET) is another popular package for creating stand-alone
|
84 |
|
|
Tcl/Tk applications. Older versions of Tix used to support
|
85 |
|
|
ET. However, the scripts of this version of Tix cannot be compiled
|
86 |
|
|
by the et2c program. If you want to use Tix in an ET-enabled
|
87 |
|
|
application, you should link libtixsam with your application and
|
88 |
|
|
call Tixsam_Init() to initialize the stand-alone Tix module. See the
|
89 |
|
|
directory demos/et for an example.
|