Kodi Community Forum

Full Version: Conditional on font tag
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, can i use a conditional to make the font be bigest, if addon name is equal to i'm pass?.

for example the first is the bigest font for addon that i want and the othrt is the default font size. is possible?
xml:

<font condition="$INFO[ListItem.AddonName] == 'code gen'">Slab-32</font>
<font>Slab-24-S</font>
nope, not possible that way at least.

perhaps you can use a $VAR[] but i'm not sure if those work in font tags.
if not, you could use an include.

and btw, that is not a valid condition. use Sting.IsEqual() if you to compare an infolabel to some text.
thanks for your help @ronie, I'm understand how can i do it now, one doubt more in DialogConfirm.xml file how can i get the variables that is passed in this case an addon. i see that has  a control label type  with id 1 but i don't understand how is that get the name addon or variable for the header.I had thought that with "ListItem.AddonName" was can get it but not worked.


thanks.
(2019-02-16, 23:18)Edoar Wrote: [ -> ]thanks for your help @ronie, I'm understand how can i do it now, one doubt more in DialogConfirm.xml file how can i get the variables that is passed in this case an addon. i see that has  a control label type  with id 1 but i don't understand how is that get the name addon or variable for the header.I had thought that with "ListItem.AddonName" was can get it but not worked.


thanks.
 try fetching it with 'Control.GetLabel(1)'
thanks @cartman.dos  your advice helped me, now i'm try make this validation but doesn't work, if i use it on "variables" tag, the Control.GetLabel(1) work fine, but when i apply it on "include" tag fails, alwas return the false validation. what i doing wrong?


Code:

    <include name="FontSize">
        <include condition="String.IsEqual(Control.GetLabel(1),code gen)">CustomFontSize</include>
        <include condition="!String.IsEqual(Control.GetLabel(1),code gen)">DefaultFontSize</include>
    </include>

    <include name="CustomFontSize">
        <font>Regular-60</font>
    </include>
    <include name="DefaultFontSize">
        <font>Slab-24-S</font>
    </include>

    <variable name="TestFontSize">
        <value condition="String.IsEqual(Control.GetLabel(1),code gen)">Regular-60</value>
        <value condition="!String.IsEqual(Control.GetLabel(1),code gen)">Slab-24-S</value>
    </variable>
(2019-02-17, 06:09)Edoar Wrote: [ -> ]thanks @cartman.dos  your advice helped me, now i'm try make this validation but doesn't work, if i use it on "variables" tag, the Control.GetLabel(1) work fine, but when i apply it on "include" tag fails, alwas return the false validation. what i doing wrong?


Code:

    <include name="FontSize">
        <include condition="String.IsEqual(Control.GetLabel(1),code gen)">CustomFontSize</include>
        <include condition="!String.IsEqual(Control.GetLabel(1),code gen)">DefaultFontSize</include>
    </include>

    <include name="CustomFontSize">
        <font>Regular-60</font>
    </include>
    <include name="DefaultFontSize">
        <font>Slab-24-S</font>
    </include>

    <variable name="TestFontSize">
        <value condition="String.IsEqual(Control.GetLabel(1),code gen)">Regular-60</value>
        <value condition="!String.IsEqual(Control.GetLabel(1),code gen)">Slab-24-S</value>
    </variable>
try making two controls (label type?)
with <visible>String.IsEqual(Control.GetLabel(1),code gen)</visible> and <visible>!String.IsEqual(Control.GetLabel(1),code gen)</visible>
it's probably the loadup order of includes making an issue...
Hi @cartman.dos,  I'm trying to add this "FontSize" validation in a "<control type =" textbox ">" to load one or another font Size. I tested "FontSize" validation and works the issue is that loads at second time, the first time fails and show default font size and the second time show the custom font size. I think is that way of code that i use, and i don't known  how can i make this validation on "include" tag.

Code:

<include name="FontSize">
        <include condition="String.IsEqual(Control.GetLabel(1),code gen)">CustomFontSize</include>
        <include condition="!String.IsEqual(Control.GetLabel(1),code gen)">DefaultFontSize</include>
    </include>

    <include name="CustomFontSize">
        <font>Regular-60</font>
    </include>
    <include name="DefaultFontSize">
        <font>Slab-24-S</font>
    </include>
i try with some ways like this

Code:

<include name="fontSize">
    <include condition="String.IsEqual(Control.GetLabel(1),error)"><font>Regular-60</font></include>
    <include condition="!String.IsEqual(Control.GetLabel(1),error)"><font>Slab-24-S</font></include>
</include>

but fails and show on logs that i have a invalid include.
(2019-02-17, 20:22)Edoar Wrote: [ -> ]Hi @cartman.dos,  I'm trying to add this "FontSize" validation in a "<control type =" textbox ">" to load one or another font Size. I tested "FontSize" validation and works the issue is that loads at second time, the first time fails and show default font size and the second time show the custom font size. I think is that way of code that i use, and i don't known  how can i make this validation on "include" tag.

Code:

<include name="FontSize">
        <include condition="String.IsEqual(Control.GetLabel(1),code gen)">CustomFontSize</include>
        <include condition="!String.IsEqual(Control.GetLabel(1),code gen)">DefaultFontSize</include>
    </include>

    <include name="CustomFontSize">
        <font>Regular-60</font>
    </include>
    <include name="DefaultFontSize">
        <font>Slab-24-S</font>
    </include>
That's why I suggested using visible tags. Includes are loaded once onload and it seems before the control id=1.
So use:

Code:

<control type="textbox">
    <visible>String.IsEqual(Control.GetLabel(1),code gen)</visible>
    <font>Regular-60</font>
    ...
</control>
<control type="textbox">
    <visible>!String.IsEqual(Control.GetLabel(1),code gen)</visible>
    <font>Slab-24-S</font>
    ...
</control>

you can decorate them with control type=group to have shared attributes/position...
oh, thank you @cartman.dos works fine!!