PDA

View Full Version : Undocumented Tags?



DrDeth
August 7th, 2007, 13:26
Hi all,

I'm busy looking at Templates - more specifically, templates created from genericcontrol.

In the 'common_templates.xml' file I see this:

<template name="checkbox">
<genericcontrol>
<stateicons>
<on>indicator_checkon</on>
<off>indicator_checkoff</off>
</stateicons>
<script file="scripts/template_checkbox.lua" />
</genericcontrol>
</template>

Its pretty self-explanatory when looked at in context, but when you compare it to the Reference Documentation, you start noticing the problem. In the documentation, genericcontrol only has two tags - icon, and iconcolor. Ahh, but it inherits from windowcontrol so it has a lot more, but neither genericcontrol nor windowcontrol contain the stateicons or script tags.

So, is it safe to assume that any tag not defined in the reference documentation is a custom property? If so, how does FG know what to do with it internally ???

Any help would be appreciated.

joshuha
August 7th, 2007, 13:46
Yes it is safe to assume that although with the case of the script tag its just not defined as such as its more of a global thing that applies in a variety of places.

But in the case above of StateIcons is just a custom property that the scriptfile makes use of. Essentially custom properties are only really useful with the LUA scripting and you can get access to them very easily.

DrDeth
August 7th, 2007, 15:13
Thanks joshuha.

So, to clarify:
1. Any 'control' can have a script.
2. Any 'control' can have custom tags, which are essentially ignored by FG, and only used in an accompanying script.

Am I right?

joshuha
August 7th, 2007, 16:40
Correct although ignored is probably not the right word. They are still processed and are sitting in memory but FG obviously doesn't do anything with them. They are only used for scripting purposes who can access the XML tags and their values.

Foen
August 7th, 2007, 18:42
It is also worth noting that the tags use the same namespace as the object they declare: to be more specific, you can get unintentional collision between a tag name and, say, an event handler.

For example:

<mycontrol><onInit>somevalue</onInit></mycontrol>

Will cause a collision between the custom tag <onInit/> and the event handler onInit(). It will usually end in tears.

Stuart
(Foen)