These instructions should be updated shortly for the new version 2.0 features
Here is a cookbook for how to write your first tclet:
Create a file named simple.tcl with this program in it.
button .b -text "Hello, world!" pack .b
Here is my first embedded tclet:
<embed src=simple.tcl width=140 height=30>
That's . You're done. This page should look like what you've created above.
Feedback is appreciated! If you want to send in a comment, just email to email@example.com. All comments are welcome, and email will be acknowledged if you include a reply-to address.
You can test your Tclet by running it in the wish shell; you don't have to run it inside Netscape. However, when you are running in the Tcl plugin you have a restricted set of Tcl commands for security reasons. The following Tcl commands are not available:
vwaitto wait for variables to change.
You can detect if you are running in the plugin by testing for the
existing of the
embed_args variable. This is an array
whose values come from the <embed> tag in the document. For example,
$embed_args(src) contains the name of the Tcl script for
the applet. You can put whatever NAME=VALUE pairs you want in the <embed>
tag. The Plugin looks at SRC, WIDTH, and HEIGHT. Any others are for
your own use.
Other Tcl variables defined especially for the plugin are:
The plugin turns off geometry propagation for the main window. All it does is:
pack propagate . false
This helps make the window the same size as the HTML width and height specifiers in the <embed> tag. Tclets you write should still work if they depend on the grid geometry manager, but in that case, you'll have to size the window yourself.
grid propagate . false