Kodi Community Forum

Full Version: Combination of Control.SetFocus and Container().CurrentItem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I`m new to skin development - I`ve only been playing around with it for the last few weeks. I`ve been playing around with a new home screen and right now i`m testing the concept, so it doesn`t look pretty, but i`ve gotten stuck at one spot.

I have a home screen and when you select the ``Movies`` item it brings up three lists which are filled with different information (eg. recently added movies, top rated movies, in progress movies). The three lists are arranged horizontally in rows of six items each. The effect is that it looks like a panel of 3 x 6, with each row being one of the above examples.

When you onright from the main menu, you are taken to the top row (list of id 311). When you click down, you are taken to the next row (list of id 312) and down again you are taken to the bottom row (list of id 313).

Ideally what i would like, is that if you are on item 4 for example of row one (list id 311), and you click down, then you are taken to item (column) 4 of row 2 (list id 312). This would give the user a feeling more like browsing a panel, rather than being taken to the last selected item before moving off the list.

I have tried to use a combination of Control.SetFocus and Container().CurrentItem within the ondown to accomplish this, but it doesn`t seem to be working - see below. I`m sure I`ve just made a newbie syntax mistake somewhere. Any assistance or suggestion is appreciated (also please remember I haven`t yet worked on making it look pretty - like using diffuse color black for selected item - so don`t make fun! Big Grin)

PHP Code:
<control type="list" id="311" description="MoviesSub1">
            <
posx>400</posx>
            <
posy>0</posy>
            <
width>1430</width>
            <
height>966</height>
            <
onup>313</onup>
            <!--<
ondown>312</ondown>-->
            <
ondown>Control.SetFocus(312,Container().CurrentItem)</ondown>
            <
onleft>300</onleft>
            <
onright>311</onright>
            <
orientation>horizontal</orientation>
            <
scrolltime>200</scrolltime>
            <
visible>Control.HasFocus(30002) | Control.HasFocus(311) | Control.HasFocus(312) | Control.HasFocus(313)</visible>
            <
itemlayout width="235" height="500">
                <
control type="image">
                    <
posx>25</posx>
                    <
info>ListItem.Art(poster)</info>
                    <
shadowcolor>ff000000</shadowcolor>
                    <
align>left</align>
                    <
aligny>top</aligny>
                </
control>
            </
itemlayout>
            <
focusedlayout width="235" height="500">
                <
control type="image">
                <
posx>25</posx>
                    <!--
not visible if other menu has focus-->
                    <
visible>!Control.HasFocus(311)</visible>
                    <
info>ListItem.Art(poster)</info>
                    <
shadowcolor>ff000000</shadowcolor>
                    <
align>left</align>
                    <
aligny>top</aligny>
                </
control>
                <
control type="image">
                    <
visible>Control.HasFocus(311)</visible>
                    <
posx>25</posx>
                    <
info>ListItem.Art(poster)</info>
                    <
align>left</align>
                    <
colordiffuse>ff000000</colordiffuse>
                </
control>
            </
focusedlayout>
            <
content limit="6">$INFO[ActivateWindow(Videos,special://skin/extras/video/TopRatedMovies.xsp,return)]</content>
</control>
<
control type="list" id="312" description="MoviesSub2">
<...>
</
control

I`ve also tried:

PHP Code:
<ondown>Control.SetFocus(312,$INFO[Container().CurrentItem])</ondown

If i put a static number in the code, such as below... it works just fine (well in that it functions as expected as I always start on item 3 in list 312)

PHP Code:
<ondown>Control.SetFocus(312,3)</ondown

I`ve searched the forum and google for examples to no avail. If anybody can point a newbie in the right direction, it would be appreciated.

Cheers,

Raze
Try using the position of the current container instead.

eg

Code:
<ondown>Control.SetFocus(312,$INFO[Container(311).Position])</ondown>
(2015-09-09, 10:30)Hitcher Wrote: [ -> ]Try using the position of the current container instead.

eg

Code:
<ondown>Control.SetFocus(312,$INFO[Container(311).Position])</ondown>

Thanks Hitcher! That worked perfectly! Cool

Any idea why Container().Current.Item doesn't work? Does it return something other than a number? I can't decipher from the wiki what the differences between the two infolabels is.

Cheers!

~Raze