Hi,
that's a bit a special case - or said in a other way: there is a reason why this code isn't working.
First it necessary to know that defining <layer> elements inside other <layer> elements is internally a 'shortcut' for setting their
parent setting.
E.g. this:
|
Quellcode
|
1
2
3
4
|
<layer name="parent_layer" ...>
<layer name="child_layer_1" ... />
<layer name="child_layer_2" ... />
</layer>
|
is the same as:
|
Quellcode
|
1
2
3
|
<layer name="parent_layer" ... />
<layer name="child_layer_1" ... parent="parent_layer" />
<layer name="child_layer_2" ... parent="parent_layer" />
|
The second thing is that the 'get:' and 'calc:' in attributes will be resolved at 'xml parsing time'. That means during parsing and transforming the xml code into read- and work-able data-structures. First all attributes with such get/calc values will be 'collected' and once the whole xml is parsed - and so all other attributes and values are accessible - they will be resolved.
But at this time, the xml data structure is still a 'raw' one, the <layer> children elements weren't converted yet to 'root-level' <layer> elements with a parent="..." setting. That happens during the next internal step after the xml parsing is done when creating the internal image, layer and hotspots objects that will be used for rendering and interacting.
That means for get:/calc: attributes the FULL 'xml path' would need to be used to address the right object/value:
E.g.
|
Quellcode
|
1
|
layer[interface_container].layer[button2].width
|
Or here a full example code:
|
Quellcode
|
1
2
3
4
5
|
<layer name="interface_container" type="container" keep="true" enabled="true" bgalpha="0.5" width="600" height="600">
<layer name="button1" type="container" width="calc:(layer[interface_container].layer[button2].width + layer[interface_container].layer[button3].width)" height="30" bgalpha="0.5" bgcolor="0xFF0000" bgborder="0,1,1,1 0xeeeeee 1" align="lefttop" y="130" x="20"/>
<layer name="button2" type="container" width="70" height="110" x="290" y="20" bgalpha="0.5" align="lefttop"/>
<layer name="button3" type="container" width="270" height="110" bgalpha="0.7" bgcolor="0xFFFFFF" x="20" y="20" bgborder="1 0xEEEEEE 1" align="lefttop" />
</layer>
|
But I agree that this is confusing and it would make more sense to have access to the 'flat' <layer> structure also for get:/calc: attribute values. I will look if that can be changed.
Best regards,
Klaus