tixForm option arg ?arg ...?
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:
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:
- Grid Attachment
- The master window is divided into a number of horizontal and vertical grids. By default the master window is divided into 100x100 grids; the number of grids can be adjusted by the tixForm grid command. A grid attachment anchor point is given by a % sign followed by an integer value. For example, %0 spceifies the first grid line (the top or left edge of the master window). %100 spceifies the last grid line (the bottom or right edge of the master window).
- Opposite Side Attachment
- Opposite attachment specifies an anchor point located on the opposite side of another slave widget, which must be managed by tixForm in the same master window. An opposite attachment anchor point is given by the name of another widget. For example, "tixForm .b -top {.a 0}" attaches the top side of the widget .b to the bottom of the widget .a.
- Parallel Side Attachment
- Opposite attachment specifies an anchor point located on the same side of another slave widget, which must be managed by tixForm in the same master window. An parallel attachment anchor point is given by the sign & follwed by the name of another widget. For example, "tixForm .b -top {&.a 0}" attaches the top side of the widget .b to the top of the widget .a, making the top sides of these two widgets at the same vertical position in their parent window.
- No Attachment
- Specifies a side of the slave to be attached to nothing, indicated by the keyword none. When the none anchor point is given, the offser must be zero.
When a side of a slave is attached to {none 0}, the position of this side is calculated by the position of the other side and the natural size of the slave. For example, if a the left side of a widget is attached to {%0 100}, its right side attached to {none 0}, and the natural size of the widget is 50 pixels, the right side of the widget will be positioned at pixel {%0 149}.
When both -top and -bottom are attached to none, then by default -top will be attached to {%0 0}. When both -left and -right are attached to none, then by default -left will be attached to {%0 0}.
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 shifted 10 pixels to the right of .a's left edge:
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 the left of the master window's right edge. An further example below shows a command with its equivalent abbreviation.
tixForm .b -top {%0 10} -bottom {%100 0}
tixForm .b -top 10 -bottom -0
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.
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 slaves' attachments is complete. Therefore, it allows intermediate states of circular dependency during the specification of the slaves' 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
Springs have not been fully implemented yet.