tixForm - Geometry manager based on attachment rules


SYNOPSIS

tixForm option arg ?arg ...?


DESCRIPTION

The tixForm command is used to communicate with the tixForm Geometry Manager, a geometry manager that arranges the geometry of the children in a parent window according to attachment rules. The tixForm geometry manager is very flexible and powerful; it can be used to emulate all the existing features of the Tk packer and placer geometry managers (see pack(n), place(n)). The tixForm command can have any of several forms, depending on the option argument:

tixForm slave ?options?
If the first argument to tixForm is a window name (any value tixForm configure.
tixForm check master
This command checks whether there is circular dependency in the DEPENDENCY below). It returns the Boolean value TRUE if it discover circular dependency and FALSE otherwise.
tixForm configure slave ?-option value ...?
Sets or adjusts the attachment values of the slave window according to the -option value argument pairs.
tixForm forget slave ?slave ...?
Removes each of the slaves from its master and unmaps their windows. The slaves will no longer be managed by tixForm. All attachment values with respect to their master windows are discarded. If another slave is attached to this slave, then the attachment of the other slave will be changed to grid attachment based on its geometry.
tixForm grid master ?x_size y_size?
When x_size and y_size are given, this command returns the number of grids of the master window in a pair of integers of the form {x_size y_size}. When both x_size and y_size are given, this command changes the number of horizontal and vertical grids on the master window.
tixForm info slave ?option?
Queries the attachment options of a slave window. option can be any of the options accepted by the tixForm configure command. If option is given, only the value of that option is returned. Otherwise, this command returns a list whose elements are the current configuration state of the slave given in the same option-value form that might be specified to tixForm configure. The first two elements in this list list are "-in master" where
tixForm slaves master
Returns a list of all of the slaves for the master window. The order of the slaves in the list is the same as their order in the packing order. If master has no slaves then an empty string is returned.

SPECIFYING ATTACHMENTS

One can specify an attachment for each side of a slave window managed by tixForm. An attachment is specified in the the form "-side {anchor_point offset}". -side can be one of -top, -bottom, -left or -right.

Offset is given in screen units (i.e. any of the forms acceptable to Tk_GetPixels). A positive offset indicates shifting to a position to the right or bottom of an anchor point. A negative offset indicates shifting to a position to the left or top of an anchor point.

Anchor_point can be given in one of the following forms:

Shifting effects can be achieved by specifying a non-zero offset with an anchor point. In the following example, the top side of widget \.b is attached to the bottom of \.a; hence \.b always appears below \.a. Also, the left edge of \.b is attached to the left side of \.a with a 10 pixel offest. Therefore, the left edge of \.b is always


        tixForm .b -left {.a 10} -top {.a 0}

ABBREVIATIONS: Certain abbreviations can be made on the attachment specifications: First an offset of zero can be omitted. Thus, the following two lines are equivalent:


        tixForm .b -top {.a 0} -right {%100 0}
        tixForm .b -top {.a}   -right {%100}

Also, because of the way TCL handles lists, when you omit the offset, you can also leave out the braces. So you can further simplify the above to:


        tixForm .b -top .a -right %100

In the second case, when the anchor point is omitted, the offset must be given. A default anchor point is chosen according to the value of the offset. If the anchor point is 0 or positive, the default anchor point %0 is used; thus, "tixForm \.b -top 15" attaches the top edge of \.b to a position 15 pixels below the top edge of the master window. If the anchor point is "-0" or negative, the default anchor point %100 is used; thus, "tixForm \.a -right -2" attaches the right edge of \.a to a position 2 pixels to below shows a command with its equivalent abbreviation.


        tixForm .b -top {%0 10} -bottom {%100 0}
        tixForm .b -top 10      -bottom -0

USING SPRINGS

To be written.

ALGORITHM OF TIXFORM

TixForm starts with any slave in the list of slaves of the master window. Then it tries to determine the position of each side of the slave.

If the attachment of a side of the slave is grid attachment, the position of the side is readily determined.

If the attachment of this side is none, then tixForm tries to determine the position of the opposite side first, and then use the position of the opposite side and the natural size of the slave to determine the position of this side.

If the attachment is opposite or parallel widget attachments, then tixForm tries to determine the positions of the other widget first, and then use the positions of the other widget and the natural size of the slave determine the position of this side. This recursive algorithmis carried on until the positions of all slaves are determined.

CIRCULAR DEPENDENCY

The algorithm of tixForm will fail if a circular dependency exists in the attachments of the slaves. For example:


	tixForm .c -left .b
	tixForm .b -right .c

In this example, the position of the left side of .b depends on the right side of .c, which in turn depends on the left side of .b.

When a circular dependency is discovered during the execution of the tixForm algorithm, tixForm will generate a background error and the geometry of the slaves are undefined (and will be arbitrary). Notice that tixForm only executes the algorithm when the specification of the attachments. Also, unlike the Motif Form manager widget, tixForm defines circular dependency as "dependency in the same dimension". Therefore, the following code fragment will does not have circular dependency because the two widgets do not depend on each other in the same dimension (\.b depends .c in the horizontal dimension and .c depends on .b in the vertical dimension):


        tixForm .b -left .c
        tixForm .c -top .b

BUGS

Springs have not been fully implemented yet.

KEYWORDS

Tix(n), Form, Geometry Management
Last modified Sun Jan 19 22:34:27 EST 1997 --- Serial 853731299