3.5 Object handling

As you've already seen RapaGUI uses XML files to create MOAI objects. When creating objects you can use all attributes marked with the letter I in the applicability section of the accompanying attribute documentation. For example, to create a textentry object with a maximum length of 80 characters you would simply use the TextEntry.MaxLen attribute and include it in your XML declaration.

 
<textentry id="mystring" maxlen="80"/>

Once your object is ready, you can start talking to it by setting or getting its attributes or by running its methods. For that purpose it is important that you give your object an identifier using the id attribute so that the functions moai.Set(), moai.Get() and moai.DoMethod() can find your object. In the code above we assigned the id mystring to our textentry widget. Here's an example of how we could talk to this widget now:

 
moai.Set("mystring", "text", "look")
s$ = moai.Get("mystring", "text")
DebugPrint("Always " .. s$ .. " on the bright side of life.")

As already mentioned above, all attributes and methods are completely documented in the documentation coming with this distribution.

The next thing you have to do is handling events that are triggered by your GUI. This is covered in the next section.


Show TOC