[comp.sys.amiga.tech] Hello World in Tcl

karl@sugar.hackercorp.com (Karl Lehenbauer) (03/02/90)

Here is a Hello World program in Tcl.  It runs under my forthcoming alpha-2
release of Tcl.
--------------
window open hello 200 50 300 50 Hello

set message "Hello, world."
set width [display textwidth $message]
set height [display fontheight]

proc refresh_window {} {
	global width height message
	window blank hello
	display move [expr {([window width hello] - $width) / 2}] [expr {([window height hello] - $height) / 2}]
	display text $message
}

refresh_window
eventloop
-----------------

refresh_window is automatically called when the window is resized.  Various
such routines exist for all the IDCMP message types.  I'm changing this to 
provide a way for you to ask routine named by you to be called when a given
IDCMP message comes in, on a window basis...maybe tomorrow.

I can't read the font off the command line yet, but the above will work
for different font sizes.
-- 
-- uunet!sugar!karl	"As long as there is a legion of superheros, all else
--			 can surely be made right." -- Sensor Girl
-- Usenet access: (713) 438-5018