Kodi Community Forum

Full Version: Var.IsEmpty similar to String.IsEmpty
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Title explains everything. This will save a looooooot of lines.

Example of the current situation:
I have a variable called $VAR[sub_label] with 50< conditions.
If I want to move a label control a few pixels to the bottom within a list - because the sub_label variable is empty - I'll have to add all those conditions as visiblity condition too.

Edit:

Example use case

Code:

<variable name="example">
<value condition="String.IsEqual(ListItem.DBType,movie)">Another movie</value>
<value condition="String.IsEqual(ListItem.DBType,tvshow)">Another tvshow</value>
</variable>

Code:

<control type="list">
...
<itemlayout>
<control type="label">
<label>My Label</label>
<animation effect="slide" end="0,10" time="0" condition="Var.IsEmpty(example)">Conditional</animation>
</control>
<control type="label">
<top>20</top>
<label>$VAR[example]</label>
</control>
</itemlayout>

<focusedlayout>
<control type="label">
<label>My Label</label>
<animation effect="slide" end="0,10" time="0" condition="Var.IsEmpty(example)">Conditional</animation>
</control>
<control type="label">
<top>20</top>
<label>$VAR[example]</label>
</control>
</focusedlayout>

</control>
Have you tried using a label ID and then Control.GetLabel(ID) for the visibility condition:
Code:
<control type="label" id="9001">
    <label>$VAR[sub_label]</label>
</control>

<visible>String.IsEmpty(Control.GetLabel(9001))</visible>
I'm aware of those "skin hacks" Smile . Off course this works, but not for a list control where I need it for every single displayed item.

Edit:
I've adjusted my example above to get a better understanding of the problem.
Ah, ok I see what you are trying to do now. I originally thought you were talking about a grouplist.

Definitely can see the use case for a normal list. Makes for much more straightforward and readable code too.

+1