Layout with Properties

Layout with Properties

Thus far we have always used our layout without properties or parameters and so we have used the short syntax.

ACORN 1.0 IWML 1.0
Page
  SimpleStack
    Text One
    Text Two
    Text Three

Layouts can have properties and parameters as well. They can also be named. To name a layout when the short syntax is used:

ACORN 1.0 IWML 1.0
Page
  SimpleStack:MyStack
    Text One
    Text Two
    Text Three

Stack

SimpleStack does not accept a parameter and has minimal properties. Let’s change SimpleStack to Stack:

ACORN 1.0 IWML 1.0
Page
  Stack:MyStack
    Text One
    Text Two
    Text Three

Layout Properties

Stack is a more capable layout than SimpleStack, but it also emits more HTML. The most commonly used property of Stack is .Orientation. Orientation can be set as a property:

ACORN 1.0 IWML 1.0
Page
  Stack
    Orientation: Horizontal
    Edit Hello World
    gap;
    Button OK

Layout with Parameters

Many layout controls support the use of parameters also. For Stack, the parameter corresponds to the .Orientation property. Thus we can rewrite the above IWML as:

If we need to set other properties not supported by the parameter, then we must revert back to the full syntax.