Click or drag to resize
CLAYOUTiAddConstraint Method
Add a constraint between any two rectangles or to one with absolute positioning

Available since Oasis montaj version: 6.3
License: Available to anyone with an Oasis Montaj license.  

Namespace: GeoEngine.Core.GXNetX
Assembly: geoengine.core.gxnetx (in geoengine.core.gxnetx.dll)
Notes
Constraints can be applied between 2 rectangles in the layout, or to 1 rectangle with absolute positioning. Use the constraints to control left, right, bottom, top, width, height, or centering configurations. Examples: (ordered as rectangle from, constraint from, rectangle to, constraint to, offset modifier, multiplicative modifier) A, &lt;define&gt;LAYOUT_CONSTR_LEFT&lt;/define&gt;, B, &lt;define&gt;LAYOUT_CONSTR_LEFT&lt;/define&gt;, 0, 0, 1.0 Set left position of A equal to left pos of B A, &lt;define&gt;LAYOUT_CONSTR_LEFT&lt;/define&gt;, B, &lt;define&gt;LAYOUT_CONSTR_RIGHT&lt;/define&gt;, 0, 0, 1.0 Set left pos of A equal to right of B The offset modifier is used for additive manipulation of constraints A, &lt;define&gt;LAYOUT_CONSTR_LEFT&lt;/define&gt;, B, &lt;define&gt;LAYOUT_CONSTR_LEFT&lt;/define&gt;, 10, 0, 1.0 Set left pos of A equal to left of B, plus 10 A, &lt;define&gt;LAYOUT_CONSTR_BOTTOM&lt;/define&gt;, B, &lt;define&gt;LAYOUT_CONSTR_TOP&lt;/define&gt;, -20, 0, 1.0 Set bottom of A equal to top of B, minus 20 Multiplicative manipulation of constraints A, &lt;define&gt;LAYOUT_CONSTR_WIDTH&lt;/define&gt;, B, &lt;define&gt;LAYOUT_CONSTR_WIDTH&lt;/define&gt;, 0, 0.5 Set the width of A equal to 0.5 times the width of B A, &lt;define&gt;LAYOUT_CONSTR_HEIGHT&lt;/define&gt;, B, &lt;define&gt;LAYOUT_CONSTR_WIDTH&lt;/define&gt;, 0, 1.2 Set the height of A equal to 1.2 times the width of B You can use BOTH the multiplicative and offset modifiers in conjunction (multiplicative gets precedence) A, &lt;define&gt;LAYOUT_CONSTR_WIDTH&lt;/define&gt;, B, &lt;define&gt;LAYOUT_CONSTR_WIDTH&lt;/define&gt;, 10, 0.5 A(width) = (0.5 * B(width)) + 10 A, &lt;define&gt;LAYOUT_CONSTR_LEFT&lt;/define&gt;, B, &lt;define&gt;LAYOUT_CONSTR_WIDTH&lt;/define&gt;, -20, 0.1 A(left) = (0.1 * B(width)) + (-20) If second node is -2, use absolute positioning A,&lt;define&gt;LAYOUT_CONSTR_LEFT&lt;/define&gt;,-2,<ignored>,25,<ignored>,<ignored> Position left of A at position 25 A,&lt;define&gt;LAYOUT_CONSTR_WIDTH&lt;/define&gt;,-2,<ignored>,30,<ignored>,<ignored> Set width of A to 30 Use the MOVE constraints to move an entire window without resizing A, &lt;define&gt;LAYOUT_CONSTR_MOVEL&lt;/define&gt;, B, &lt;define&gt;LAYOUT_CONSTR_LEFT&lt;/define&gt;, 0, 0, 1.0 Move node A, align left with left side of B A, &lt;define&gt;LAYOUT_CONSTR_MOVEL&lt;/define&gt;, B, &lt;define&gt;LAYOUT_CONSTR_RIGHT&lt;/define&gt;, 0, 0, 1.0 Move node A, align left with right side of B A, &lt;define&gt;LAYOUT_CONSTR_MOVET&lt;/define&gt;, B, &lt;define&gt;LAYOUT_CONSTR_WIDTH&lt;/define&gt;, 0, 0, 1.0 Move node A, align bottom to position equal to width of B A, &lt;define&gt;LAYOUT_CONSTR_MOVER&lt;/define&gt;, B, &lt;define&gt;LAYOUT_CONSTR_RIGHT&lt;/define&gt;, 10, 1.1 Move node A, align right to 1.1*right of B, plus 10 A, &lt;define&gt;LAYOUT_CONSTR_MOVEL&lt;/define&gt;, NULL, 10, 0, 1.0 Move node A, align left at position 10
Syntax
public int iAddConstraint(
	int rect_from,
	int constr_from,
	int rect_to,
	int constr_to,
	double o_mod,
	double m_mod
)

Parameters

rect_from
Type: SystemInt32
From rectangle (Or -1 for parent)
constr_from
Type: SystemInt32
&lt;define&gt;LAYOUT_CONSTR&lt;/define&gt; From constraint flag
rect_to
Type: SystemInt32
To rectangle (Or -1 for parent Or -2 for absolute positioning)
constr_to
Type: SystemInt32
&lt;define&gt;LAYOUT_CONSTR&lt;/define&gt; To constraint flag
o_mod
Type: SystemDouble
Offset modifier
m_mod
Type: SystemDouble
Multiplicative modifier

Return Value

Type: Int32
0 - OK 1 - Error
See Also