<constantlayout>

Arranges a set of views to a constant 'x' or 'y' value.

JavaScript: constantlayout

Extends Layout

constantlayout extends LzLayout, and therefore it is responsible for arranging all of the subviews for the view that it is attached to. The attributes of a view that constantlayout effects are the x and y values, and as its name implies constantlayout sets all of the subviews to the same value.

<canvas height="100">
  <view bgcolor="red" >
    <view width="80" height="80" bgcolor="teal"/>       
    <view width="60" height="60" bgcolor="silver"/> 
    <view width="40" height="40" bgcolor="green"/>           
    <constantlayout axis="x" value="10"/>
  </view >
</canvas>

In this example the teal, silver and green views are aligned on the horizontal (x) axis; the layout element's value attribute (10) causes the subviews to be shifted ten pixels to the right.

<canvas height="100" >
  <view bgcolor="red" >
    <view width="80" height="80" bgcolor="teal"/>       
    <view width="60" height="60" bgcolor="silver"/> 
    <view width="40" height="40" bgcolor="green"/>           
    <constantlayout axis="y" value="10"/>
  </view >
</canvas>

In this example the teal, silver and green views are aligned on the vertical (x) axis; the layout element's value attribute (10) causes the subviews to be shifted ten pixels down.

Attributes
Name Usage Type (Tag) Type (JS) Default Category
axis Tag & JS string String y setter
 

The axis in which this layout operates either 'x' or 'y'.


value Tag & JS expression any   setter
 

The constant value that is applied to the attribute ( defined in 'axis' as 'x' or 'y' ) of each subview in the layout.



Attributes inherited from Layout

defaultplacement, delegates, locked, subviews, updateDelegate, view.layouts

Attributes inherited from Node

class, classroot, cloneManager, datapath, id, ignoreAttribute, ignoreplacement, immediateparent, initstage, name, nodeLevel, onconstruct, oninit, parent, placement, subnodes


Methods

update()
constantlayout.update()

This method is called automatically by the layout. However it can be called directly to force the layout to update



Methods inherited from LzLayout

addSubview, ignore, lock, releaseLayout, removeSubview, reset, setLayoutOrder, swapSubviewOrder, unlock

Methods inherited from LzNode

animate, applyConstraint, applyData, childOf, completeInstantiation, construct, createChildren, dataBindAttribute, destroy, determinePlacement, getAttribute, getOption, getUID, init, lookupSourceLocator, searchImmediateSubnodes, searchSubnodes, setAttribute, setDatapath, setID, setName, setOption


Events

Events inherited from LzNode

onconstruct, ondata, oninit