[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

#### 4.19.9.1 A Quick Example

You do not define an entire window (though you can) using the XML. Rather, you may define the contents of some widget.

    contents =
    	<layout type="Vertical">
    		 <layout type="Horizontal">
    		 	<widget type="Button">
    		 		<event name="onDrawContent" action="buttonDrawText('Reset')" />
    		 	</widget>
    		 	<widget type="Label">
    		 		<text>Reset all particle fountain variables</text>
    		 	</widget>
    		 </layout>

    		 <layout type="Horizontal">
    		 	<widget type="Button">
    		 		<event name="onDrawContent" action="buttonDrawText('Pause')" />
    		 	</widget>
    		 	<widget type="Label">
    		 		<text>Pause the particle fountain</text>
    		 	</widget>
    		 </layout>
    	</layout>;

As you can see, XML is simply part of the language. The interface definition allows you to specify nodes of two types: layout or widget. In reality, they are the same thing, but they are called different things in the UI definition in order to bring clarity to the structure.

One important thing to note ist that there must be only one top-level node. In this case it's a layout node. It may be any node type, but there must be only one.

In order to turn this into a widget, you call a simple function `ParseXMLInterface`, as seen below:

`ParseXMLInterface(xml_object, parent_widget)`

  Takes an XML object and turns it into a widget. If parent_widget is not null, all widgets in the xml_object will be added as children to parent_widget.

    some_widget = ParseXMLInterface(contents, null);

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ]

This document was generated using texi2html 1.76.