TCL is a script language for use in XWindows. The TCL program below is the start of a program development tool and demonstrates the use of text, label, and button widgets in a frame.
We need a decent xwindows text editor
Make the program fte
Create a file named "progtool.tcl" with the contents shown in the box:
proc exec_cmd {command} {
proc edit_file { } {
#
#
#
# Edit
#Man Pages
# Exit program
#pack buttons in order - a button will not appear until it is packed |
proc is a tag for a procedure or subroutine. The procedures here are
exec_cmd which is used to pass parameters to the exec command and
edit_file which is used to invoke textedit which is a nice text editor for XWindows
While in textedit use the right mouse button while selecting the buttons at the top of the display.
back is a variable used to hold a value for the background color. Note the references to $back throughout the program.
button is followed by the name of the button (and the frame that contains it) with parameters for a label (-text "Edit"), its command (command {edit_file}), and its background color (-bg $back).
pack causes the button to be displayed.
More information is available on the man pages for button, eval, frame & label.
Open a shell in XWindows, change to the directory containing PROGTOOL.TCL, and type "wish8.3 progtool.tcl"