<resizelayout>
A layout with fixed and stretchable views.

JavaScript: lz.resizelayout
extends <layout> » <node> » lz.Eventable »
resizelayout extends <layout>, and therefore is responsible for arranging a set of views. Like simplelayout, resizelayout positions a set of views vertically or horizontally depending on the axis specified. The difference is that resizelayout can also stretch views.
<canvas height="100">
  <view bgcolor="yellow" width="200">
    <view bgcolor="blue" height="30" width="50"/>
    <view bgcolor="red" height="30" width="50"/>
    <view bgcolor="blue" height="30" width="50"/>
    <simplelayout axis="x" spacing="10"/>
  </view>
  
  <view y="40" bgcolor="yellow" width="200">
    <view bgcolor="blue" height="30" width="50"/>
    <view bgcolor="red" height="30" options="releasetolayout"/>
    <view bgcolor="blue" height="30" width="50"/>
    <resizelayout axis="x"/>
  </view>
</canvas>

This example is similar to the one used in <stableborderlayout>, and is in fact visually equivalent. This is because <stableborderlayout> is a special case of resizelayout that is optimized for the common occurrence of having two fixed views with one stretchable view between them.

Unlike <stableborderlayout>, resizelayout works with any number of views. All the views that are controlled by a resizelayout are assumed to be fixed size until defined differently. A view is defined as stretchable using the attribute options="releasetolayout". These views will stretch to fill in the space that is not taken by the fixed views. The resizelayout uses the width (or height) of its view to determine the total amount of space to fill, and then those subviews are placed and stretched to fill that space. If there is more than one subview that is stretchable, then the available space is split evenly between those subviews.

Then next example demonstrates what happens when two views are stretchable. The difference between the top and bottom views is only the spacing attribute.

<canvas height="100">
  <view bgcolor="yellow" width="300">
    <view bgcolor="blue" height="30" width="50"/>
    <view bgcolor="red" height="30" options="releasetolayout"/>
    <view bgcolor="blue" height="30" width="50"/>
    <view bgcolor="red" height="30" options="releasetolayout"/>
    <resizelayout axis="x"/>
  </view>

  <view y="40" bgcolor="yellow" width="300">
    <view bgcolor="blue" height="30" width="50"/>
    <view bgcolor="red" height="30" options="releasetolayout"/>
    <view bgcolor="blue" height="30" width="50"/>
    <view bgcolor="red" height="30" options="releasetolayout"/>
    <resizelayout axis="x" spacing="5"/>
  </view>
</canvas>

Attributes

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'.
spacing expression any 0 read/write
  A pixel amount to use between each view in the layout

Attributes inherited from <layout>

locked, subviews, updateDelegate

Methods

hold()
resizelayout.hold(subview : lz.view);
holding a subview keeps it from being resized when the parent view resizes
Parameter Name Type Description
subview lz.view the subview to be held ( not resized )

release()
resizelayout.release(subview : lz.view);
releasing a subview allows the layout to resize it when the parent view stretches
Parameter Name Type Description
subview lz.view the subview to be resized

setAxis()
resizelayout.setAxis(a : string);
setter for the axis attribute. The default value is 'y'
Parameter Name Type Description
a string 'x' oy 'y'

update()
resizelayout.update(e : deprecated);
This method is usually called automatically when any of the views controlled by the layout change their size in the layout axis, or their visibility. However it can be called directly to force the layout to update
Parameter Name Type Description
e deprecated there are no arguments to this update method

Methods inherited from lz.Eventable

destroy, setAttribute

Events

Events inherited from <node>

onconstruct, ondata, oninit

Events inherited from lz.Eventable

ondestroy