If $VAR is empty visibility condition
#1
Apologies if this is a basic question or has been answered before. I'm beginner level and have tried searching for help, but I'm going wrong somewhere. I'm trying to reverse engineer bits of code from different skins to get the desired result.

I think what I'm trying to achieve is this: 272579 (thread)

I have a $VAR that is populated with the location of various MPAA rating flags. If it is empty (i.e. if there is no flag being shown), I want to change the visibility of a different control.

I have tried adding a hidden label control with an arbitrary ID showing the $VAR with a fallback "EMPTY". My code is in includes.xml:
Quote:        <control type="label" id="78600">
            <font>list_focused</font>
            <visible>false</visible>
            <label fallback="EMPTY">$VAR[Info_Certificate]</label>
        </control>
Next, I tried to use a String.IsEqual comparison of this hidden label with the fallback value "EMPTY" to use as a visibility condition on a different control when the $VAR doesn't have a value. This second control is situated in the same <include>:
Quote:        <control type="image">
            <right>150</right>
            <bottom>0</bottom>
            <width>120</width>
            <height>80</height>
            <aspectratio>keep</aspectratio>
            <texture colordiffuse="$VAR[TextColor]" fallback="">$INFO[ListItem.Studio,flags/studios/,.png]</texture>
            <visible>!String.Contains(ListItem.Icon,Default) + !Container.Content(artists) + String.IsEqual(Control.GetLabel(78600),EMPTY)</visible>
        </control>
I've also tried String.IsEmpty(Control.GetLabel(78600)) but neither of these are working. Does anyone have nay ideas where I'm going wrong?

Thanks in advance
Reply
#2
You might try this in the visible tag of the image:

Code:
!String.Contains(ListItem.Icon,Default) + !Container.Content(artists) + String.IsEmpty($VAR[Info_Certificate])

I must admit though that string comparison in skins always seems like a bit of a black art to me. I'm not sure you can use any of the string comparisons on VARS, and the wiki page for booleans seems to indicate you can only do String operations on info labels.  When a skin xml file is being parsed there also appears to be an order of operation that I've never figured out, so it's possible your control label isn't getting it's value set in time for the comparison to work.
Providing a debug log: Log_file/Easy (wiki)
Leia Estuary mod: 333143 (thread)
Artist Slideshow: Add-on:Artist_Slideshow (wiki)
SpeedFan Information Display: Add-on:SpeedFan_Information_Display (wiki)
Reply
#3
Just add EMPTY as the last value in the variable.

ie

<variable name="Info_Certificate">
    ...
    <value>EMPTY</value>
</variable>
Reply
#4
In my opinion, kodi does not allow to compare variables. Try:

String.IsEqual(Control.GetLabel(78600),)
 Image
Reply
#5
(2019-08-26, 08:56)Hitcher Wrote: Just add EMPTY as the last value in the variable.

ie

<variable name="Info_Certificate">
    ...
    <value>EMPTY</value>
</variable>
Thanks Hitcher, worked a treat!
Reply
 
Thread Rating:
  • 0 Vote(s) - 0 Average



Logout Mark Read Team Forum Stats Members Help
If $VAR is empty visibility condition00