20-Apr-05 (Created: 20-Apr-05) | More in 'laszlo'

Laszlo basic sample code

An empty rectangular canvas


<canvas width="500" height="150" bgcolor="green">
</canvas>

Displays a green canvas with those settings

A simple window on a canvas


<canvas width="500" height="150">
  <window/>
</canvas>

Displays a window that has no body to it.


<canvas width="500" height="300">
  <window x="20" y="20" width="200" height="250"/>
</canvas>

window with a body and positioning (x,y) top right in pixels

window with a title


<canvas width="500" height="350">
  <window x="20" y="20" width="200" height="250" 
          title="Simple Window" resizable="true" />
</canvas>

This window is resizable.

window with text


<canvas width="500" height="350">
  <window x="20" y="20" width="200" height="250" 
          title="Simple Window" resizable="true">
    <text>Here is some text.</text>
  </window>
</canvas>

Window with positioned text


<canvas width="500" height="250">
  <window x="20" y="20" width="200" height="250" 
          title="Simple Window" resizable="true">
    <text x="10" y="10">Here is some text.</text>
    <text x="10" y="50">I could ramble for hours.</text>
  </window>
</canvas>

An alternate way to position the text


<canvas width="500" height="350">
  <window x="20" y="20" width="200" height="250" 
          title="Simple Window" resizable="true">
    <simplelayout axis="y" spacing="10" />
    <text>Here is some text.</text>
    <text>I could ramble for hours.</text>
  </window>
</canvas>

Uses a layout that is vertically spaced by 10 pixels between siblings