<class>

Defining your own tags.

The <class> tag defines a new tag, which be used anywhere in the source file where a built-in tag such as <view> or <layout> can be used.

Defines a new XML tag name, that can be used in the remainder of the application source. An element whose name is this tag name will inherit the attributes and content of this definition.

For example,

<class name="mywindow" extends="window" layout="y" title="My Class">
  <text>my class</text>
</class>

defines a new tag named mywindow. This tag can be used anywhere that window is used.

<mywindow x="10">
  <button>Click</button>
</mywindow>

is equivalent to

<window layout="y" title="My Class">
  <text>my class</text>
  <button>Click</button>
</window>

Class definitions must precede view definitions that use the name of the class. An application can use a tag that is defined in a library, if the library is included before the point where the tag is used.

For an introduction to classes in LZX, see the Classes tutorial. For a concise explanation of classes in LZX, see the Classes chapter in the Guide. For advanced topics see the Extending Classes chapter.

Attributes
Name Usage Type (Tag) Type (JS) Default Category
extends Tag only token view final
 

The name of the tag that this tag extends.


name Tag only token   final
 

The name of a new tag that this element defines.