Version 1 of Useful Basic TCL Formulas

Updated 2005-02-16 00:43:42

Robert Abitbol There are a lot of basic TCL formulas which are needed and useful in a lot of programs. This is some of them. Since I am a beginner, please don't be shy and don't hesitate to contradict me if what I am saying is wrong! Thanks!

Association of files: protocol

- You want a function to behave like another? Protocol is your friend. Ex: wm protocol . WM_DELETE_WINDOW do.exit

Here we are asking the program to treat the user's clicking on the top right of the first stripe, as if it were an exit. Thus the user will be asked questions such as: "the file has not been saved. Save it?" etc. when he'll click on the X at the top of the screen.. In fact the sequence will be identical as the exit sentence. Mm! Very useful!


- Calling a box with text: easy! Ex: tk_messageBox -message "Sorry, this function isn't ready yet."}

The full function would be:

proc preferences {}{tk_messageBox -message "Sorry, this function isn't ready yet. Come back later :-)"}


- More to come