I thought I would post this problem/solution here for future reference.
ITEM 1
An ongoing issue during development of my TPA Panel Kit project in FS2004 had been as follows:
Lighting controlled by two switch choices: a light mode specific switch, and/or a master lighting (all modes toggled) switch.
Individually they work fine. But if the master switch is toggled ON, then OFF (thus toggling both instrument lights (A:LIGHT PANEL,bool), and separate panel lights (L:Var) controlled), and immediately afterward an (L:Var) panel light is individually toggled... The result is that not only the (L:Var) panel light comes on, but also the Luminous="Yes" (A:LIGHT PANEL,bool) lights for some gauges as well.
At first I thought this an issue with the master light switch, but repeated attempts to solve it were futile.
CAUSE:
Many of my gauge elements are built with the face being lit by Luminous="Yes" (A:LIGHT PANEL,bool) on the bitmap. Stacked later in the XML are some bezel elements which are toggled by the <Visible> tag.
I stumbled onto the key when I found that once a Luminous="Yes" has been lit and turned OFF, toggling any <Visible> tag higher in the stack (lower in the XML script) would "drag" the Luminous="Yes" element back to illumination.
An example of my XML construction:
Once the first element had been turned ON/OFF by the (A:LIGHT PANEL,bool) parameter, toggling the second element (L:Var) would drag the first element back into illumination.
SOLUTION: Double wrap element tags when using <Visible> tags.
And the problem is gone.
ITEM 2:
For my various layers of panel lighting, toggling the master lights on/off and then toggling on/off the "dome lights" (L:Var), the "panel edge lights" (L:Var) would illuminate out of nowhere. No Luminous bitmaps involved here.
Examining the XML showed that the bitmap which would erroneously appear was the LOWEST (listed first in the XML) in the stack.
Example code:
CAUSE: Seems like the lowest bitmap in the stack will remain visible after a higher <visible> element is toggled, if there is nothing else below it. This based on swapping out bitmaps and the element order in the XML.
SOLUTION: Double wrap element tags when using <Visible> tags, same as above.
Sample code:
Problem gone. All bitmaps hide when the they are commanded.
An interesting aside, both items above only seem to occur when their XML are loaded on the main panel (visible, anyway). On other popup panels and such which are initially NOT visible, I cannot recreate this oddity.
ITEM 1
An ongoing issue during development of my TPA Panel Kit project in FS2004 had been as follows:
Lighting controlled by two switch choices: a light mode specific switch, and/or a master lighting (all modes toggled) switch.
Individually they work fine. But if the master switch is toggled ON, then OFF (thus toggling both instrument lights (A:LIGHT PANEL,bool), and separate panel lights (L:Var) controlled), and immediately afterward an (L:Var) panel light is individually toggled... The result is that not only the (L:Var) panel light comes on, but also the Luminous="Yes" (A:LIGHT PANEL,bool) lights for some gauges as well.
At first I thought this an issue with the master light switch, but repeated attempts to solve it were futile.
CAUSE:
Many of my gauge elements are built with the face being lit by Luminous="Yes" (A:LIGHT PANEL,bool) on the bitmap. Stacked later in the XML are some bezel elements which are toggled by the <Visible> tag.
I stumbled onto the key when I found that once a Luminous="Yes" has been lit and turned OFF, toggling any <Visible> tag higher in the stack (lower in the XML script) would "drag" the Luminous="Yes" element back to illumination.
An example of my XML construction:
Code:
<Element>
<Position X="0" Y="0"/>
<Image Name="dial_face.bmp" Luminous="Yes"/>
</Element>
<Element>
<Visible>(L:PanelLights,bool)</Visible>
<Position X="0" Y="0"/>
<Image Name="bezel.bmp" Bright="Yes"/>
</Element>
Once the first element had been turned ON/OFF by the (A:LIGHT PANEL,bool) parameter, toggling the second element (L:Var) would drag the first element back into illumination.
SOLUTION: Double wrap element tags when using <Visible> tags.
Code:
<Element>
<Position X="0" Y="0"/>
<Image Name="dial_face.bmp" Luminous="Yes"/>
</Element>
<Element>
<Visible>(L:PanelLights,bool)</Visible>
<Element>
<Position X="0" Y="0"/>
<Image Name="bezel.bmp" Bright="Yes"/>
</Element>
</Element>
And the problem is gone.
ITEM 2:
For my various layers of panel lighting, toggling the master lights on/off and then toggling on/off the "dome lights" (L:Var), the "panel edge lights" (L:Var) would illuminate out of nowhere. No Luminous bitmaps involved here.
Examining the XML showed that the bitmap which would erroneously appear was the LOWEST (listed first in the XML) in the stack.
Example code:
Code:
<Element>
<Visible>(LVar1,bool)</Visible>
<Position X="0" Y="0"/>
<Image Name="panel_light1.bmp" Bright="Yes"/>
</Element>
<Element>
<Visible>(LVar2,bool)</Visible>
<Position X="0" Y="0"/>
<Image Name="panel_light2.bmp" Bright="Yes"/>
</Element>
<Element>
<Visible>(LVar3,bool)</Visible>
<Position X="0" Y="0"/>
<Image Name="panel_light3.bmp" Bright="Yes"/>
</Element>
CAUSE: Seems like the lowest bitmap in the stack will remain visible after a higher <visible> element is toggled, if there is nothing else below it. This based on swapping out bitmaps and the element order in the XML.
SOLUTION: Double wrap element tags when using <Visible> tags, same as above.
Sample code:
Code:
<Element>
<Visible>(LVar1,bool)</Visible>
<Element>
<Position X="0" Y="0"/>
<Image Name="panel_light1.bmp" Bright="Yes"/>
</Element>
</Element>
<Element>
<Visible>(LVar2,bool)</Visible>
<Element>
<Position X="0" Y="0"/>
<Image Name="panel_light2.bmp" Bright="Yes"/>
</Element>
</Element>
<Element>
<Visible>(LVar3,bool)</Visible>
<Element>
<Position X="0" Y="0"/>
<Image Name="panel_light3.bmp" Bright="Yes"/>
</Element>
</Element>
Problem gone. All bitmaps hide when the they are commanded.
An interesting aside, both items above only seem to occur when their XML are loaded on the main panel (visible, anyway). On other popup panels and such which are initially NOT visible, I cannot recreate this oddity.
