20 Nov 2019 - TVDB Scraper v3.2.0 is now available which reinstates scraping. TVDB are still in the process of fixing a number of bugs so there may still be further breakages. See this post. 2901570 (post)

Issue with Visibility Conditions for Panel
#1
Hello all,

I am having an issue with visibility conditions for a panel I am using as a widget in Amber for Leia.  I understood that testing for numitems > 0 or that the panel isupdating would work, but it does not and I have not been able to figure out why.  Below are exceprts from the code of the skin.  For reference:

1. HomeShelf is the include that draws the widgets. This is used in Home.xml.  I did not include that part of the code here.
2. ShelfList is the group of widgets (up to 2 in this example).
3. Each individual widget is in ShelfSubList.

Excerpts of the code:

    <include name="HomeShelf">
        <param name="xoffset"/>
        <param name="yoffset"/>
        <param name="shelfwidth"/>
        <definition>
            <control type="group">
                <include content="ShelfList">
                    <param name="menuvisibility">Container(300).HasFocus(4)</param>
                    <param name="shelfvisible">![Skin.HasSetting(Hide.Movies.Shelf) | Skin.HasSetting(Hide.RecentlyAdded)]</param>
                    <param name="selectionlistid">400</param>
                    <param name="selectionlistlabel1">$LOCALIZE[20386]</param>
                    <param name="selectionlistlabel2">$LOCALIZE[31071]</param>
                    <param name="selectionlistvisible1">!Skin.HasSetting(Hide.Movies.Shelf.RecentlyAdded)</param>
                    <param name="selectionlistvisible2">!Skin.HasSetting(Hide.Movies.Shelf.InProgress)</param>
                    <param name="listitemtype1">Shelf_Posters</param>
                    <param name="listitemtype2">Shelf_Posters</param>
                    <param name="listitemlabel1">MoviesLabel</param>
                    <param name="listitemlabel2">MoviesLabel</param>
                    <param name="listitemcontent1">special://skin/xsp/movies_recentlyadded.xsp</param>
                    <param name="listitemcontent2">special://skin/xsp/movies_inprogress.xsp</param>
                </include>
            </control>
        </definition>
    </include>    
    
    <include name="ShelfList">
        <param name="menuvisibility"/>
        <param name="shelfvisible"/>
        <param name="shelfplex">false</param>
        <param name="selectionlistid"/>
        <param name="selectionlistlabel1"/>
        <param name="selectionlistlabel2"/>
        <param name="selectionlistvisible1">false</param>
        <param name="selectionlistvisible2">false</param>
        <param name="listitemtype1">Shelf_Posters</param>
        <param name="listitemtype2">Shelf_Posters</param>
        <param name="listitemtype3">Shelf_Posters</param>
        <param name="listitemlabel1">MoviesLabel</param>
        <param name="listitemlabel2">MoviesLabel</param>
        <param name="listitemcontent1"/>
        <param name="listitemcontent2"/>
        <param name="listitemcontenttype1">Path</param>
        <param name="listitemcontenttype2">Path</param>
        <param name="listitemsortby1"/>
        <param name="listitemsortby2"/>
        <param name="listitemsortorder1">descending</param>
        <param name="listitemsortorder2">descending</param>
        <param name="listitemlimit1">$VAR[ShelfSize]</param>
        <param name="listitemlimit2">$VAR[ShelfSize]</param>
        <param name="listitemtarget1">video</param>
        <param name="listitemtarget2">video</param>
        <definition>
            <control type="group">
                
                <animation effect="slide" start="0,0" end="-430,0" time="0" delay="0" reversible="true" condition="!Skin.HasSetting(VerticalHome)">conditional</animation>
                <animation effect="slide" start="0,0" end="0,-100" time="0" delay="0" reversible="true" condition="Skin.HasSetting(Shelf.DoubleHeight)">conditional</animation>
                <left>430</left>
                <top>283</top>
                <height>700</height>
                <visible>$PARAM[menuvisibility]</visible>
                <visible>$PARAM[shelfvisible]</visible>

                <control type="grouplist" id="$PARAM[selectionlistid]8">
                    <height>707</height>
                    <width>1920</width>
                    <orientation>vertical</orientation>
                    <onup>$PARAM[selectionlistid]8</onup>
                    <ondown>300</ondown>
                    <scrolltime>0</scrolltime>
                    <include content="ShelfSubList">
                        <param name="itemid">1</param>
                        <param name="listitemonup">$PARAM[selectionlistid]2</param>
                        <param name="listitemondown">$PARAM[selectionlistid]2</param>
                        <param name="selectionlistid">$PARAM[selectionlistid]</param>
                        <param name="selectionlistlabel">$PARAM[selectionlistlabel1]</param>
                        <param name="listitemtype">$PARAM[listitemtype1]</param>
                        <param name="listitemcontent">$PARAM[listitemcontent1]</param>
                        <param name="listitemcontenttype">$PARAM[listitemcontenttype1]</param>
                        <param name="listitemsortby">$PARAM[listitemsortby1]</param>
                        <param name="listitemsortorder">$PARAM[listitemsortorder1]</param>
                        <param name="listitemlimit">$PARAM[listitemlimit1]</param>
                        <param name="listitemtarget">$PARAM[listitemtarget1]</param>
                        <param name="listitemlabel">$PARAM[listitemlabel1]</param>
                        <param name="listitemvisible">$PARAM[selectionlistvisible1]</param>
                    </include>
                    <include content="ShelfSubList">
                        <param name="itemid">2</param>
                        <param name="listitemonup">$PARAM[selectionlistid]1</param>
                        <param name="listitemondown">$PARAM[selectionlistid]1</param>
                        <param name="selectionlistid">$PARAM[selectionlistid]</param>
                        <param name="selectionlistlabel">$PARAM[selectionlistlabel2]</param>
                        <param name="listitemtype">$PARAM[listitemtype2]</param>
                        <param name="listitemcontent">$PARAM[listitemcontent2]</param>
                        <param name="listitemcontenttype">$PARAM[listitemcontenttype2]</param>
                        <param name="listitemsortby">$PARAM[listitemsortby2]</param>
                        <param name="listitemsortorder">$PARAM[listitemsortorder2]</param>
                        <param name="listitemlimit">$PARAM[listitemlimit2]</param>
                        <param name="listitemtarget">$PARAM[listitemtarget2]</param>
                        <param name="listitemlabel">$PARAM[listitemlabel2]</param>
                        <param name="listitemvisible">$PARAM[selectionlistvisible2]</param>
                    </include>
                </control>

            </control>
        </definition>
    </include>

    <include name="ShelfSubList">
        <param name="itemid"/>
        <param name="selectionlistid"/>
        <param name="selectionlistlabel"/>
        <param name="listitemtype"/>
        <param name="listitemcontent"/>
        <param name="listitemcontenttype"/>
        <param name="listitemsortby"/>
        <param name="listitemsortorder"/>
        <param name="listitemlimit"/>
        <param name="listitemtarget"/>
        <param name="listiteminclude"/>
        <param name="listitemlabel"/>
        <param name="listitemvisible"/>
        <param name="listitemonup"/>
        <param name="listitemondown"/>
        <param name="plex">false</param>
        <definition>
            <control type="group">
                <visible>$PARAM[listitemvisible]</visible>
                <visible>Integer.IsGreater(Container($PARAM[selectionlistid]$PARAM[itemid]).NumItems,0) | Container($PARAM[selectionlistid]$PARAM[itemid]).IsUpdating</visible>
                <include condition="Skin.HasSetting(VerticalHome)">Vertical_SubShelf_Commons</include>
                <include condition="!Skin.HasSetting(VerticalHome)">Horizontal_SubShelf_Commons</include>
                <height>707</height>
                <control type="image">
                    <width>1920</width>
                    <include condition="Skin.HasSetting(Shelf.DoubleHeight)">Double_SubShelf_BGHeight</include>
                    <include condition="!Skin.HasSetting(Shelf.DoubleHeight)">Single_SubShelf_BGHeight</include>
                    <texture border="0,40,0,00">home/ShelfBackground.png</texture>
                </control>
                <control type="label">
                    <visible>Control.HasFocus($PARAM[selectionlistid]$PARAM[itemid])</visible>
                    <top>-6</top>
                    <height>45</height>
                        <label>$INFO[Container($PARAM[selectionlistid]$PARAM[itemid].ListItem.Label,,]</label>
                    <font>Shelf_Title</font>
                    <textcolor>Highlight</textcolor>
                    <textoffsetx>16</textoffsetx>
                    <aligny>center</aligny>
                </control>
                <control type="label">
                    <visible>!Control.HasFocus($PARAM[selectionlistid]$PARAM[itemid]) + Skin.HasSetting(Show_Library_Count)</visible>
                    <top>-6</top>
                    <height>45</height>
                    <label>$VAR[LibraryStats]</label>
                    <textoffsetx>16</textoffsetx>
                    <font>Shelf_Title</font>
                    <aligny>center</aligny>
                </control>
                <control type="label">
                    <top>-6</top>
                    <height>45</height>
                    <label>$PARAM[selectionlistlabel]</label>
                    <font>Shelf_Title</font>
                    <textcolor>Highlight</textcolor>
                    <align>right</align>
                    <aligny>center</aligny>
                </control>
                <control type="panel" id="$PARAM[selectionlistid]$PARAM[itemid]">
                    <visible>$PARAM[listitemvisible]</visible>
                    <onup>$PARAM[listitemonup]</onup>
                    <onup>Control.Move($PARAM[selectionlistid]9,1)</onup>
                    <ondown condition="!Skin.HasSetting(VerticalHome)">300</ondown>
                    <ondown condition="Skin.HasSetting(VerticalHome)">$PARAM[listitemondown]</ondown>
                    <onright>$PARAM[selectionlistid]$PARAM[itemid]</onright>
                    <onback>300</onback>
                    <onleft condition="Skin.HasSetting(VerticalHome)">300</onleft>
                    <onleft condition="!Skin.HasSetting(VerticalHome)">$PARAM[selectionlistid]$PARAM[itemid]</onleft>
                    <left>32</left>
                    <top>53</top>
                    <include condition="Skin.HasSetting(Shelf.DoubleHeight)">Double_SubShelf_Height</include>
                    <include condition="!Skin.HasSetting(Shelf.DoubleHeight)">Single_SubShelf_Height</include>
                    <include condition="Skin.HasSetting(VerticalHome)">Vertical_SubShelf_Commons</include>
                    <include condition="!Skin.HasSetting(VerticalHome)">Horizontal_SubShelf_Commons</include>
                    <orientation>horizontal</orientation>
                    <include>VisibleFadeEffectDelayShelf</include>
                    <itemlayout height="315" width="228.5">
                        <include content="GenericPosterIconShelf">
                            <param name="isFocused">false</param>
                        </include>
                    </itemlayout>
                    <focusedlayout height="315" width="228.5">
                        <include content="GenericPosterIconShelf">
                            <param name="isFocused">Control.HasFocus($PARAM[selectionlistid]$PARAM[itemid])</param>
                        </include>
                    </focusedlayout>
                    <content sortby="$PARAM[listitemsortby]" sortorder="$PARAM[listitemsortorder]" limit="$PARAM[listitemlimit]" target="$PARAM[listitemtarget]">$PARAM[listitemcontent]</content>
                </control>
            </control>
        </definition>
    </include>

My apologies for the long code snippet, I just wanted it to be complete enough to be followed.

My issue is that I had to add another visibility condition in ShelfSubList (line 127 in the code snippet)
<visible>$PARAM[listitemvisible]</visible>
, because if I only had the visibility condition below that
<visible>Integer.IsGreater(Container($PARAM[selectionlistid]$PARAM[itemid]).NumItems,0) | Container($PARAM[selectionlistid]$PARAM[itemid]).IsUpdating</visible>
then the widgets would not be displayed at all.

I hope someone can assist me with this issue, and I can provide any additional information that might be required.  Thanks in advance.

Regards,

Bart
Reply
#2
The visible condition needs to be inside the panel container. The issue is because when it is in the parent group the condition is initially false -- the container has no items and is not updating because it has never been visible. As a result, the group is never visible because the IsUpdating condition is always false.

When the visible condition is instead inside the panel, the panel gets created before its visible condition evaluates and so the IsUpdating condition is initially true.

You need to separate the panel from the group and then use the visible conditions like so:
Code:
<control type="group">
    <visible>Control.IsVisible($PARAM[selectionlistid]$PARAM[itemid])</visible>
    [... group content goes here ...]
</control>

<control type="panel" id="$PARAM[selectionlistid]$PARAM[itemid]">
    <visible>Integer.IsGreater(Container($PARAM[selectionlistid]$PARAM[itemid]).NumItems,0) | Container($PARAM[selectionlistid]$PARAM[itemid]).IsUpdating</visible>
</control>

This approach can be a pain inside grouplists though! You will need to use <usecontrolcoords>true</usecontrolcoords> and then a negative <top> value to position the panel at the correct point in the group (or vice versa depending on whether the group or panel comes first).
Reply
#3
(2019-06-22, 04:54)jurialmunkey Wrote: The visible condition needs to be inside the panel container. The issue is because when it is in the parent group the condition is initially false -- the container has no items and is not updating because it has never been visible. As a result, the group is never visible because the IsUpdating condition is always false.

When the visible condition is instead inside the panel, the panel gets created before its visible condition evaluates and so the IsUpdating condition is initially true.

You need to separate the panel from the group and then use the visible conditions like so:
Code:
<control type="group">
<visible>Control.IsVisible($PARAM[selectionlistid]$PARAM[itemid])</visible>
[... group content goes here ...]
</control>

<control type="panel" id="$PARAM[selectionlistid]$PARAM[itemid]">
<visible>Integer.IsGreater(Container($PARAM[selectionlistid]$PARAM[itemid]).NumItems,0) | Container($PARAM[selectionlistid]$PARAM[itemid]).IsUpdating</visible>
</control>

This approach can be a pain inside grouplists though! You will need to use <usecontrolcoords>true</usecontrolcoords> and then a negative <top> value to position the panel at the correct point in the group (or vice versa depending on whether the group or panel comes first). 
@jurialmunkey , thanks! I will try this today and see how it goes.

Regards,

Bart
Reply
#4
(2019-06-22, 04:54)jurialmunkey Wrote: The visible condition needs to be inside the panel container. The issue is because when it is in the parent group the condition is initially false -- the container has no items and is not updating because it has never been visible. As a result, the group is never visible because the IsUpdating condition is always false.

When the visible condition is instead inside the panel, the panel gets created before its visible condition evaluates and so the IsUpdating condition is initially true.

You need to separate the panel from the group and then use the visible conditions like so:
Code:
<control type="group">
<visible>Control.IsVisible($PARAM[selectionlistid]$PARAM[itemid])</visible>
[... group content goes here ...]
</control>

<control type="panel" id="$PARAM[selectionlistid]$PARAM[itemid]">
<visible>Integer.IsGreater(Container($PARAM[selectionlistid]$PARAM[itemid]).NumItems,0) | Container($PARAM[selectionlistid]$PARAM[itemid]).IsUpdating</visible>
</control>

This approach can be a pain inside grouplists though! You will need to use <usecontrolcoords>true</usecontrolcoords> and then a negative <top> value to position the panel at the correct point in the group (or vice versa depending on whether the group or panel comes first).  
@jurialmunkey , I tried this and the visibility conditions work fine for the panel and for the group.  It was not working initially for the group, because I had not specified  <top> and <left> coordinates for it.

When the panel has 0 items, neither the panel nor the group show up, which is exactly what I was trying to fix in the first place.

If I could bother you (or anyone who might be reading this and knows) some more.  If I have multiple widgets, all with content, how would I go about showing just one at a time? Wouldn't the visibility conditions make it so that multiple groups and panels are shown? Is this something that could be done with conditional animations? Unfortunately, this is something that I know very little about.

Again, thank you for taking the time to help me out.

Regards,

Bart
Reply
#5
(2019-06-23, 22:14)bsoriano Wrote: If I could bother you (or anyone who might be reading this and knows) some more.  If I have multiple widgets, all with content, how would I go about showing just one at a time? Wouldn't the visibility conditions make it so that multiple groups and panels are shown? Is this something that could be done with conditional animations? Unfortunately, this is something that I know very little about.
Hi bart,

Not sure if this is the most efficient method, you could use set a property based on navigation.

Visibility for the 1st widget
Code:
<visible>String.IsEmpty(Window(home).Property(WidgetFocus)</visible>

Navigate to 2nd widget
Code:
<onup>SetProperty(WidgetFocus,1,home)</onup>

Visibility for the 2nd widget
Code:
<visible>String.IsEqual(Window(home).Property(WidgetFocus),1)</visible>

Navigation to 1st widget
Code:
<ondown>ClearProperty(WidgetFocus,Home)</ondown>
Reply
#6
(2019-06-24, 10:47)Mr. V Wrote:
(2019-06-23, 22:14)bsoriano Wrote: If I could bother you (or anyone who might be reading this and knows) some more.  If I have multiple widgets, all with content, how would I go about showing just one at a time? Wouldn't the visibility conditions make it so that multiple groups and panels are shown? Is this something that could be done with conditional animations? Unfortunately, this is something that I know very little about.
Hi bart,

Not sure if this is the most efficient method, you could use set a property based on navigation.

Visibility for the 1st widget
Code:
<visible>String.IsEmpty(Window(home).Property(WidgetFocus)</visible>

Navigate to 2nd widget
Code:
<onup>SetProperty(WidgetFocus,1,home)</onup>

Visibility for the 2nd widget
Code:
<visible>String.IsEqual(Window(home).Property(WidgetFocus),1)</visible>

Navigation to 1st widget
Code:
<ondown>ClearProperty(WidgetFocus,Home)</ondown>

@Mr. V, thank you so much! I will try this and see how it goes.

Regards,

Bart
Reply
 
Thread Rating:
  • 0 Vote(s) - 0 Average



Logout Mark Read Team Forum Stats Members Help
Issue with Visibility Conditions for Panel00