On Tue, 18 Feb 1997, Chester, Tony, CHESTEAP wrote:
>
> Tony,
>
> >I have a seperate tcl script with a bunch of procedures in it; if I
> >source the tcl file in the init procedure, all of the code gets sucked
> >into the vtcl-generated script.
>
> I am doing a very similar thing and it works just fine.
> What I have found is that VTcl writes procedures in the interpreter that
> belong to your application back into the main file. So if you generate a
> VTcl file, then hand modify it to source your other file; if you load the
> modified file back into VTcl and re-save it you will find the procedures
> from your external file written into the VTcl generated file.
> This is OK, but I like to keep some procedures in a separate file so they
> are not accessed until they are needed.
Well, I can't get this to happen. Instead I have a problem where I'm
*loosing* toplevel proc code from my vtcl file when I source a file
containing a procedure.
I'm using vTcl-1.08 with the latest non-beta TCL/TK on Linux (ie. not v8
or whatever). I can repeat the problem by doing the following:
1) create a file called include.tcl containing:
proc yyy {} {
puts "Hello"
}
2) start vTcl and create a new application
- create a toplevel window
- create a button in the window
At this point you can verify that the app can be saved, and re-opened ok.
3) edit the init proc and add:
source include.tcl
The same thing happens if I use:
uplevel #0 source include.tcl
4) save the application and re-open it. The toplevel window doesn't
appear.
5) edit the vtcl app file with another editor and remove the "source
include.tcl" line.
6) close (don't save) and re-open the app in vtcl. The toplevel window is
back again.
Repeating steps 3, 4, 5, and 6 always gives the same results.
If you save the app just before step 5 you will see that the toplevel
window proc and the call to the Window proc that creates it have been
removed from the vtcl file.
Contrary to what others are finding, I haven't found a situation where the
proc in include.tcl gets inserted within the vtcl file. Is this behaviour
dependent in some way on the content of the sourced file?
+----------------------+---+
| Ross Johnson | | E-Mail: [EMAIL PROTECTED]
| Info Sciences and Eng|___|
| University of Canberra | FAX: +61 6 2015227
| PO Box 1 |
| Belconnen ACT 2616 | WWW: http://willow.canberra.edu.au/~rpj/
| AUSTRALIA |
+--------------------------+