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
.
Example 67. Using constantboundlayout
<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
.
Example 68. Aligning on the vertical axis
<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
>
Name (CSS property) | Type (tag) | Type (js) | Default | Category |
---|---|---|---|---|
axis
|
string | String | y | read/write |
The axis in which this layout operates either 'x' or 'y'. | ||||
value
|
expression | any | 0 | read/write |
The constant value that is applied to the attribute ( defined in 'axis' as 'x' or 'y' ) of each subview in the layout. |
classroot, cloneManager, data, datapath, defaultplacement, id, ignoreplacement, immediateparent, inited, initstage, name, nodeLevel, options, parent, placement, styleclass, subnodes, transition
Methods
addSubview, ignore, lock, releaseLayout, removeSubview, reset, setLayoutOrder, swapSubviewOrder, unlock, update
animate, applyConstraintMethod, applyData, childOf, completeInstantiation, construct, createChildren, dataBindAttribute, destroy, determinePlacement, getOption, getUID, init, lookupSourceLocator, releaseConstraint, releaseConstraintMethod, searchImmediateSubnodes, searchSubnodes, setOption, setSelected, updateData
Events
Copyright © 2002-2010 Laszlo Systems, Inc. All Rights Reserved. Unauthorized use, duplication or distribution is strictly prohibited. This is the proprietary information of Laszlo Systems, Inc. Use is subject to license terms.