View Full Version : Custom Attributes
sandman
02-17-2003, 12:34 PM
Hi,
How do I declare attributes for a class? I have created a class which is subclassed from view and now I want to add custom attributes and be able to get and set the value for these attributes. Looking at the
documentation for the "class" tag it seems it is possible but its not very clear. A code snippet would help.
thanks,
Sandeep.
You might want something like this
<class name="icecreamsundae" extends="view">
<attribute name="flavor" value="vanilla" type="string" />
<attribute name="spoonsize" value="100" />
</class>
The data type of an attribute will default to "expression", which essentially means that you
can pass any expression via the XML syntax, but you will need to quote string
literals. If you want to pass only string literals, use the "string" type to avoid needing an extra level of quoting.
From Javascript, you can now call setAttribute and getAttribute on these attribute names, as well as using XML (lzx) syntax for initializers like
<icecreamsundae flavor="chocolate" spoonsize="parent.width / 2" />
The 'extends="view" 'is optional, the default baseclass is 'view'.
Maybe Antun can tell us where this stuff is documented?
antun
02-18-2003, 09:28 AM
Maybe Antun can tell us where this stuff is documented?
Right now the best documented example of this is the window tutorial:
http://www.laszlosystems.com/developers/learn/documentation/tutorials/window.php#class
We don't have a tutorial that deals with classes in specific, although we will very soon.
-Antun
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.