Kodi Community Forum
Bug Using <visible>!IsEmpty($PARAM[foobar])</visible> is opposite expected behaviour - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Skinning (https://forum.kodi.tv/forumdisplay.php?fid=12)
+--- Thread: Bug Using <visible>!IsEmpty($PARAM[foobar])</visible> is opposite expected behaviour (/showthread.php?tid=238293)



Using <visible>!IsEmpty($PARAM[foobar])</visible> is opposite expected behaviour - jurialmunkey - 2015-09-09

On Isengard - I just noticed that if using IsEmpty to check if a $PARAM has a value it has the opposite behaviour from what is expected.

For instance if I have in my include:
Code:
<param name="foo" value="bar" />

And then I check within the include definition if the value is not empty:
Code:
<control type="label">
    <label>$PARAM[foo]</label>
    <visible>!IsEmpty($PARAM[foo])</visible>
</control>

I will get the opposite of the expected behaviour -- IsEmpty will return true and !IsEmpty will return false when it should be the other way around.


RE: Using <visible>!IsEmpty($PARAM[foobar])</visible> is opposite expected behaviour - phil65 - 2015-09-09

that code only seems correct for InfoLabels, and even then it should be
Code:
<label>$INFO[$PARAM[foo]]</label>
.


RE: Using <visible>!IsEmpty($PARAM[foobar])</visible> is opposite expected behaviour - jurialmunkey - 2015-09-09

I'm passing through localized strings - e.g. <param name="foo" value="$LOCALIZE[8]" />

Passing a label through a param works fine. Getting the label to show isn't the problem though. Its that the IsEmpty true and false conditions are inverted for params.

e.g. this will show the label "bar" when it shouldn't (and vice versa for !IsEmpty)
Code:
<control type="label">
    <label>$PARAM[foo]</label>
    <visible>IsEmpty($PARAM[foo])</visible>
</control>



RE: Using <visible>!IsEmpty($PARAM[foobar])</visible> is opposite expected behaviour - jurialmunkey - 2015-09-09

Also from the thread on params:

(2015-04-04, 02:49)rahotep Wrote: Any appropriate value can be passed as parameter in the new include call, including $INFO labels, $LOCALIZE, $VARs, constants, etc. Empty string (value="") can also be passed, for example to override a non-empty default value set in the include definition



RE: Using <visible>!IsEmpty($PARAM[foobar])</visible> is opposite expected behaviour - phil65 - 2015-09-09

yeah but your way would lead to "!IsEmpty($LOCALIZE[xxx]) which is not supported. In that case you would have to use another PARAM.