Class “Constraint”
Represents a constraint on the layout of a widget that the parent uses to determine the position of one of its edges. See also ConstraintValue
Type: | Constraint extends Object |
Constructor: | public |
Singleton: | No |
Namespace: | tabris |
Direct subclasses: | None |
JSX Support: | No |
Constructor
new Constraint(reference, offset)
Parameter | Type | Description |
---|---|---|
reference | Percent | SiblingReference |
Sets the reference property. |
offset | Offset |
Sets the offset property. |
Methods
toArray()
A tuple consisting of the values of the reference
and offset
properties, i.e. [reference, offset]
.
Returns: ConstraintArray
toString()
A string representation of the constraint as a space separated string in the pattern of 'reference offset'
.
Returns: string
Static Methods
from(constraintValue)
Creates a new instance of Constraint using any valid constraint expression. For any other value, including null
and 'auto'
, the method throws.
Parameter | Type | Description |
---|---|---|
constraintValue | ConstraintValue |
The value to create an Constraint instance from. |
Returns: Constraint
Properties
offset
An additional distance between the reference point and the edge of the widget itself.
Type: | Offset |
Settable: | Yes |
This property can only be set via constructor. Once set, it cannot change anymore.
reference
A reference point from which the offset is added. Either a SiblingReference - indicating the opposing edge of that widget - or a Percent
instance, indicating a fraction of the width/height (padding excluded) of the parent widget.
If the sibling reference is a string it will be a valid selector string and not contain any pseudo selectors ('next()'
/'prev()'
).
Type: | Percent | SiblingReference |
Settable: | Yes |
This property can only be set via constructor. Once set, it cannot change anymore.
Static Properties
next
A SiblingReference indicating the next widget in the list of children attached to the same parent. Used by the reference
property. Also available as LayoutData.next
.
Type: | unique symbol |
Settable: | No |
prev
A SiblingReference indicating the previous widget in the list of children attached to the same parent. Used by the reference
property. Also available as LayoutData.prev
.
Type: | unique symbol |
Settable: | No |