From: cwe@dront.nada.kth.se (Christian Wettergren)
Subject: Wanted: Geometry handlers like TeX Glue...
Organization: Royal Institute of Technology, Stockholm, Sweden
Date: Tue, 17 Nov 1992 15:04:14 GMT

Hello!

First, I would like to praise Tk. It's everything I ever
wanted. Thanks everyone who has developed it!

I have one "idea" about how Tk might improve though. 

I think the weakest part of Tk is it's geometry handlers; 'pack'
and 'place'. Of course, almost anything is possible to create
with pack/frame, but it rapidly becomes awkward. (I don't
think other toolboxes are substantially better at managing these
things, but I'm not a very experienced X-hacker.)

I would love to have something like TeX Glue for placing objects.
I know, TeX glue does not provide enough flexibility, since it
only handles the space between objects, not the objects' sizes.
But I would like to have something in the same spirit. 

At KTH, a Scheme to X toolbox has been developed that has some
of these capabilities, namely SCIX/STOX. Maybe some of these 
features could be transferred to Tk?

From Section 'Boxes and Glue' in 'STOX, the Scheme Toolkit for X'
(not transcribed exactly, somewhat shortened):

   "STOX includes a TeX-based scheme for placement of widgets. 
    The classes concerned are hglue, vglue, hbox-aux and 
    vbox-aux. None of these are normally used directly. Instead 
    they are accessed through a number of convenience functions.
    (see below).

    The hglue constructor accepts (pixel measures):
    'width, 'height, 'borderwidth
    'stretch		strechability ('inf possible)
    'shrink		shrinkability ('inf possible)

    vglue accepts the same keywords, but with the obvious 
    changes in meaning.

    The hbox-aux accepts the following keywords:
    'contents		The contents to keep track of. Default:
			(hglue 'stretch 'inf)
    'width		Default: total width of contents
    'height		Default: max of height of contents
    'x, 'y		position of the box

    'natural-height	returns the height/width of the box 
    'natural-width 	unstretched and unshrinked.
    'set-width!		Sets the width to new width/height
    'move		Changes position of the box
    'arrange		Reorders the box 

    vbox-aux accepts the same keywords, but with the obvious
    changes in meaning.
    
    Convenience functions:
    (hfill)		(hglue 'make 'stretch 'inf)
    (hss)		(hglue 'make 'stretch 'inf 'shrink 'inf)
    (hskip amount)	(hglue 'make 'width amount)
    (hbox [c])	 	(hbox-aux 'make ['contents c])
    (hbox-to w [c])	(hbox-aux 'make 'width w ['contents c])

    The same but in vertical direction is of course defined too.

    The practical use of this approach to widget layout can be 
    studied in the example applications and (for the non-TeX-
    speaking) also in Knuth's 'The TeXbook'."

(Transcribed without permission. Sorry Johan and Haakan, I'll
make it up to you :-) )
  
What do others think about Tk and geometry handlers? Would it 
be hard or inefficient to do this? Am I missing something
obvious here?


Regards,
	Christian Wettergren, cwe@nada.kth.se

-- 
--------------------------------------------------------------------------
Christian Wettergren, cwe@nada.kth.se, 08 - 641 14 02
Hi! I am a mutating signature viruSTOMP!eacheSTOMP!e too!
STOMP! STOMP! STOMP! SigVirCatcher was here!
Newsgroups: comp.lang.tcl