|
MoreMotion Face Elements |
|
|
MoreMotion Face elements are designated with special "mo:" attributes attached to standard elements in a HTML document.
After a HTML document is loaded on the browser, the OMgr.initialize() method of MoreMotion Face traverses all the DOM nodes of the document to find nodes marked with these special attributes. mo:type attribute defines the type of the object. If there is a corresponding type definition object in the OMgr.types[] array and if the object has a init() function then MoreMotion Face call this function and passes the current DOM node object to it to let it initialize. The special attributes that turns a standard HTML element into a MoreMotion Face Element are as follows: mo:type attribute Defines the type of the element. Usually there is a wrapper Javascript class with this type that extends MoreMotionObject base class. mo:name attribute The name of the element and the instantiated Javascript object. This attribute is optional and if omitted the name of the instantiated object is taken from the name attribute of the HTML element. mo:props attribute This attribute keeps the properties of the element in "propA: 'valueA', propB: 'valueB'" format. The properties of a MoreMotion object can also be supplied as Javascript objects or functions. In that case the first character of the attribute value must be "*" followed by the object of the function name. Example:
mo:value attribute The initial value of the element if applicable.
Example: Below is a MoreMotion Face element called UpperCaseBox. The purpose of this element is to convert the initial or the changed value of a standard HTML INPUT element to uppercase. The element has only one property that defines whether only the first letters of the words or all the letters are to be converted to uppercase.
Note that there is a call to a static function repaint() in the onchange event of the element to reformat the updated value. See how this function instantiates the UpperCaseBox class and calls its repaint() method.
|