TGML DOM Methods
The following is an overview of the methods that are specific for the TGML DOM methods that do not exist in standard DOM implementations, that is, methods unique for TGML.
For more information, see the W3C Document Object Model (DOM) Level 3 Core Specification.
Attribute | Type | Description |
---|---|---|
Any element |
getChildByName("‹name›")
|
Returns the child element that has the Name attribute with the given value. If no such element exists, this returns null. If more than one element has a Name attribute with that value, what is returned is undefined. |
Any element |
getChild ("‹name›") |
Returns the immediate child element that has the Name attribute with the given value. If no such child exists, this returns null. If more than one immediate child element has a Name attribute with that value, what is returned is undefined. |
Any element |
getChildRecursive ("‹name›") |
Returns the child element at any level that has the Name attribute with the given value. If no such element exists, this returns null. If more than one element has a Name attribute with that value, what is returned is undefined. |
Bind or Link |
getFullBindName() |
Returns the exposed name of the Bind or Link element, including names of parent components. |
Example:
<TGML>
<Component Name="MyComponent" Left="50.0" Top="50.0 Width="100.0" Height="100.0" ContentHeight="100.0" ContentWidth=100.0>
<Script OnMouseClick="click"><![CDATA [
function click(evt)
{
var rectangle = evt.getTarget();
var bind = rectangle.getChild("Value");
var name = bind.getFullBindName(); //"MyComponent.Value"
....
}
]]></Script>
<Rectangle Left="0.0" Top="0.0 Width="100.0" Height="100.0" Fill="#FFFFFF" Stroke=#000000">
<Bind Name="Value" Attribute="Fill" />
</Rectangle>
</Component>
</TGML>