scripting-tutorial-$13.lzx

<canvas width="100%" height="200">
  <window x="100" y="60" title="Window 2" name="windowTwo">
    <text>This is the second window.</text>
  </window>
  <window x="20" y="20" width="210" title="Simple Window">
    <simplelayout axis="x" spacing="4"/>
    <button text="My button" name="button1" onclick="this.moveWindow()">
      <!-- Moves the second window twenty pixels 
           to the right -->
      <method name="moveWindow">
        var increment = 20;
        var originalX = this.parent.parent.windowTwo.x;
        var newX = originalX + increment;
        this.parent.parent.windowTwo.setAttribute('x', newX);
      </method>
    </button>
    <button text="Bigger Button" onclick="this.parent.button1.moveWindow()"/>
  </window>
</canvas>
<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
* Copyright 2008 Laszlo Systems, Inc.  All Rights Reserved.                   *
* Use is subject to license terms.                                            *
* X_LZ_COPYRIGHT_END ****************************************************** -->

Cross References

Named Instances