Containers - last focused position
#1
I have two lists, one has static content (lets call it list_1), the other one (list_2) has dynamic content (plugin://) which is derived from a property of list_1.
So depending on the focused position of list_1 other content is displayed in list_2.

I wanted to use this construction for a home screen widget with (recommended, recent, etc. content)

But unfortunately every time list_1 gets focused it shows item no. 1 and not like I would expect, the last focused position.
Somehow list_2 remembers the last focused position and not stars always on position no. 1.

Any clues on who/why/when containers can remember they last focused position?
Reply
#2
I managed to do the same thing but with grouplists. You can try and use this condition for list_2 items:
Code:
ControlGroup(Id).HasFocus(Id)
Where you would pass list_1 id and the Id of the button innside list_1.
This one returns focused or last focused for ControlGroup (grouplist).

But beware that it does not work well with mouse\touch, only keyboard.
HTPC Server - Windows 8.1 + XBMC Helix | Intel QuadCore, 4GB RAM, 4 TB SATA
Intel NUC D54250WYK - Windows 8.1 + XBMC Helix | Logitech Harmony 750
Samsung UE8005 | Bluetooth keyboard & mousepad
Reply
#3
Check the ID for list 1 isn't used elsewhere.
Reply
#4
The ID of list_1 (ID 9100) isn't used anywhere for sure.

I just wonder why the position of list_2 (ID 8000) is being remembered even though the content changes.

Here is an excerpt from my code

PHP Code:
<control type="group">
    <
left>1028</left>
    <
top>452</top>
    <
visible>Container(9000).Hasfocus(1)</visible>
    <
control type="list" id="9100">
        <
description>Movie Widget</description>
        <
left>0</left>
        <
top>0</top>
        <
width>240</width>
        <
height>230</height>
        <
visible>!Control.HasFocus(8000)</visible>
        <
onup>8000</onup>
        <
ondown>9000</ondown>
        <
viewtype label="WidgetList">list</viewtype>
        <
orientation>horizontal</orientation>
        <
scrolltime tween="sine" easing="out">200</scrolltime>
        <
itemlayout/>
        <
focusedlayout height="230" width="240">
            <
control type="group">
                <
visible>Skin.HasSetting(nomoviewidget)</visible>
                <
control type="label">
                    <
description>Widget Name</description>
                    <
left>0</left>
                    <
top>25</top>
                    <
width>220</width>
                    <
height>40</height>
                    <
align>center</align>
                    <
aligny>center</aligny>
                    <
label>$INFO[ListItem.Label]</label>
                    <
font>cirrus_20</font>
                    <
textcolor>c0FFFFFF</textcolor>
                    <
shadowcolor>black</shadowcolor>
                </
control>
            </
control>
        </
focusedlayout>
        <
content>
            <
item id="1">
                <
label>Recent Movies</label>
                <
onclick>noop</onclick>
                <
property name="foo">videodb://recentlyaddedmovies/</property>
                
<visible>Container(9000).Hasfocus(1)</visible>
            </
item>
            <
item id="2">
                <
label>Random Movies</label>
                <
onclick>noop</onclick>
                <
property name="foo">plugin://service.library.data.provider?type=randommovies&amp;reload=10&amp;limit=10</property>
                
<visible>Container(9000).Hasfocus(1)</visible>
            </
item>
        </
content>
    </
control>
    <
control type="group">
        <
left>342</left>
        <
top>-22</top>
        <
control type="list" id="8000">
            <
viewtype label="535">list</viewtype>
            <
left>0</left>
            <
top>5</top>
            <
width>800</width>
            <
height>275</height>
            <
onleft>SetFocus(9000)</onleft>
            <
onright>8001</onright>
            <
pagecontrol>-</pagecontrol>
            <
itemlayout height="25" width="800">
                <
control type="label">
                    <
left>20</left>
                    <
top>26</top>
                    <
width>250</width>
                    <
height>23</height>
                    <
font>cirrus_20</font>
                    <
textcolor>grey</textcolor>
                    <
shadowcolor>black</shadowcolor>
                    <
selectedcolor>selected</selectedcolor>
                    <
align>left</align>
                    <
aligny>center</aligny>
                    <
scroll>false</scroll>
                    <
label>$INFO[ListItem.Label]</label>
                </
control>
            </
itemlayout>
            <
focusedlayout height="25" width="800">
                <
control type="label">
                    <
left>20</left>
                    <
top>26</top>
                    <
width>250</width>
                    <
height>23</height>
                    <
font>cirrus_20</font>
                    <
textcolor>black</textcolor>
                    <
selectedcolor>selected</selectedcolor>
                    <
align>left</align>
                    <
aligny>center</aligny>
                    <
scroll>false</scroll>
                    <
label>$INFO[ListItem.Label]</label>
                </
control>
            </
focusedlayout>
            <
content limit="10">$INFO[Container(9100).ListItem.Property(foo)]</content>
        </
control>
    </
control>
</
control
Reply
#5
Possibly because when it regains focus it has to check the visible conditions and the last focus position isn't available instantly so it revert back to position 1.

EDIT: As a test pull out the visible conditions in the items and see what happens.
Reply
#6
What if you try using a panel insteed of a list ?
Reply
#7
(2014-12-10, 21:21)Hitcher Wrote: Possibly because when it regains focus it has to check the visible conditions and the last focus position isn't available instantly so it revert back to position 1.

EDIT: As a test pull out the visible conditions in the items and see what happens.

Also though about trying this.

EDIT: this doesn't seem to fix the problem

(2014-12-10, 21:37)butchabay Wrote: What if you try using a panel insteed of a list ?

How could using a panel influence this behaviour? But I will see if anything changes.
Reply
#8
(2014-12-10, 21:37)butchabay Wrote: What if you try using a panel insteed of a list ?

I didn't come so far to test the panel, because a wraplist did the thing.

But I still don't know why Smile
Reply
#9
Because a list behaves in a different way as a wraplist or panel.
Reply

Logout Mark Read Team Forum Stats Members Help
Containers - last focused position0