<constantboundslayout>

Arranges a set of views to a constant 'x' or 'y' value with a bounding rect

JavaScript: constantboundslayout

Extends Layout

A <view> can have an xoffset and a yoffset. These offsets allow the view to be placed relative to the point (xoffset, yoffset). (Otherwise the view is placed using the view's top left corner as a reference point.) If a view has an offset, then this will effect how layouts position it relative to other views.

The easiest way to see how constantboundslayout works is to contrast it with <constantlayout> as shown here.

The example below shows three views, one with an xoffset value of five. When using just a constantlayout the yellow view is shifted left five pixels because of its xoffset.

<canvas height="85">
  <view bgcolor="red" >
    <view width="80" height="80" bgcolor="yellow" xoffset="5"/>       
    <view width="60" height="60" bgcolor="silver"/> 
    <view width="40" height="40" bgcolor="green"/>           
    <constantlayout axis="x" value="10"/> 
  </view >
</canvas>

With a constantboundslayout that offset is effectively ignored, meaning only the bounds of the view matters in the layout process. The example below shows all of the subviews now aligned with the use of a constantboundslayout.

<canvas height="85">
  <include href="utils/layouts/constantboundslayout.lzx"/>
  <view bgcolor="red">
    <view width="80" height="80" bgcolor="yellow" xoffset="5"/>       
    <view width="60" height="60" bgcolor="silver"/> 
    <view width="40" height="40" bgcolor="green"/>           
    <constantboundslayout axis="x" value="10"/>
  </view >
</canvas>
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 0 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

addSubview()
constantboundslayout.addSubview(newsub)

this method is called by the layout class as each new subview is added to a layout. It is extended here to define which events on a subview will activate the update method of this particular layout

Parameters
Name Type Desc
newsub None


update()
constantboundslayout.update()

this method is called by the layout class everytime an event (that has been registered with the updatedelegate) is sent by a subview or the layout's parent view.



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