Conditionally sizing textboxes
#1
I have a bunch of textboxes in a skin that need to be sized conditionally on the visibility of some other controls. I wanted to make an include to work this out rather than duplicating the conditional everywhere, so I thought to do something like:

Code:
<include name="PlotBox_Small">
        <height>68</height>
        <autoscroll time="4000" delay="12000" repeat="8000">Skin.HasSetting(AutoScroll)</autoscroll>
        <font>METF_PlotTextSmall</font>
</include>
<include name="PlotBox_Large">
        <height>135</height>
        <autoscroll time="4000" delay="16000" repeat="8000">Skin.HasSetting(AutoScroll)</autoscroll>
        <font>METF_PlotTextMedium</font>
</include>
<include name="PlotBox">
        <posx>300</posx>
        <posy>565</posy>
        <width>750</width>
        <textcolor>LowerText</textcolor>
        <include condition="Control.IsVisible(9902) | Control.IsVisible(9905) | Control.IsVisible(9906)">PlotBox_Small</include>
        <include condition="![Control.IsVisible(9902) | Control.IsVisible(9905) | Control.IsVisible(9906)]">PlotBox_Large</include>
</include>

Which of course doesn't work, as conditional includes are only evaluated at startup.

But.. is there a nice way to do what I'm after?
Reply
#2
I would use
PHP Code:
<include name="Plots">
<
textbox>
        <
visible>Condition 1</visible>
        <
height>68</height>
        <
autoscroll time="4000" delay="12000" repeat="8000">Skin.HasSetting(AutoScroll)</autoscroll>
        <
font>METF_PlotTextSmall</font>
</
textbox>
<
textbox 2>
        <
visible>!Condition 1</visible>
        <
height>135</height>
        <
autoscroll time="4000" delay="16000" repeat="8000">Skin.HasSetting(AutoScroll)</autoscroll>
        <
font>METF_PlotTextMedium</font>
</
itextbox2>
</include> 
My skins:

Amber
Quartz

Reply
#3
Maybe I'm just over tired.. but then how would I set the <info> tag (the contents of the textbox) outside of the include? The text to be displayed is different in each case.
Reply
#4
I would use (am using) $VARs for that.
My skins:

Amber
Quartz

Reply
#5
Ahh.. that's why I was blocking on this. I keep forgetting we have variables in skins now. Thanks!
Reply

Logout Mark Read Team Forum Stats Members Help
Conditionally sizing textboxes0