Kodi Community Forum
Problem with list scrolling back to the top by itself (solved) - 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: Problem with list scrolling back to the top by itself (solved) (/showthread.php?tid=193369)



Problem with list scrolling back to the top by itself (solved) - Alex... - 2014-04-27

Hello there!

I'm currently working on a skin and the forum has been a great help, as I managed to repair many things using the information found here. This time though, I couldn't find a solution to my problem no matter what I tried, so I'm hoping someone with more experience and knowledge can help me.

I want to create a grouplist in SkinSettings.xml which holds custom settings, each with a set of subordinate settings only visible if the main setting is enabled. I'm posting two screenshots; maybe it makes more sense:

Image

Image

The hidden settings show up as expected when the visibility condition is met. My only problem is that when I scroll down the expanded list (with some of the hidden settings now shown) and I focus on a "subordinate" button, the list scrolls back to the top. This happens only when I focus on a button. If I scroll down the list carefully and focus on the thumbnail (in the second screenshot), the list doesn't scroll back up.

At first, the structure of my settings list was:
Code:
    Grouplist
        Setting 1 (radiobutton/togglebutton)
            List of settings that are only visible when Setting 1 is enabled. (group/grouplist/list)[/list]
        Setting 2 (radiobutton/togglebutton)
            List of settings that are only visible when Setting 2 is enabled. (group/grouplist/list)[/list]
        ... and so on.


Thinking that there might be a conflict between the <pagecontrol> tags of the main list and the subordinate lists, I got rid of the subordinate lists and kept only the settings. So I changed the structure to:
Code:
    Grouplist
        Main Setting 1
        Subordinate Setting 1.1 - only visible when Setting 1 is enabled.
        Subordinate Setting 1.2 - only visible when Setting 1 is enabled.
        [...] Subordinate Setting 1.n - only visible when Setting 1 is enabled.
        Main Setting 2
        Subordinate Setting 2.1 - only visible when Setting 1 is enabled.
        Subordinate Setting 2.2 - only visible when Setting 1 is enabled.
        ... and so on.
but it didn't work...

Here's the code taken from SkinSettings.xml:

PHP Code:
<control type="group" id="9100" description="Container for Settings">
    <
top>100</top>
    <
width>720</width>
    <
height>700</height>
    <
onleft>9000</onleft>
    <
control type="grouplist" id="9001" description="Home Menu Settings">
        <
usecontrolcoords>true</usecontrolcoords>
        <
onup>9001</onup>
        <
ondown>9001</ondown>
        <
pagecontrol>61</pagecontrol>
        <
itemgap>0</itemgap>
        <
visible>Container(9000).Hasfocus(1)</visible>
        <include>
HomeMenuSettings</include>
    </
control>
    <
control type="scrollbar" id="61" description="Settings Scrollbar">
        <include>
ScrollbarV</include>
        <
left>720</left>
        <
height>690</height>
        <
onleft>9001</onleft>
        <
onright>noop</onright>
        <
visible>Control.IsVisible(9001)</visible>
    </
control>                
    <
control type="grouplist" id="9003" description="Backgrounds">
        <
onup>9003</onup>
        <
ondown>9003</ondown>                        
        <
pagecontrol>63</pagecontrol>
        <
itemgap>0</itemgap>
        <
visible>Container(9000).Hasfocus(3)</visible>
        <include>
BackgroundsSettings</include>
    </
control>
    <
control type="scrollbar" id="63" description="Settings Scrollbar">
        <include>
ScrollbarV</include>
        <
left>720</left>
        <
height>690</height>
        <
onleft>9003</onleft>
        <
onright>noop</onright>
        <
visible>Control.IsVisible(9003)</visible>
    </
control>
</
control

The <include>HomeMenuSettings</include> and <include>BackgroundsSettings</include>: (It's quite long, so I'm posting only a part of it, but the rest of it is similar)

PHP Code:
<include name="HomeMenuSettings">
    <!-- 
Options for showing VIDEOS Menu and Submenu -->
    <
control type="radiobutton" id="101" description="Show Videos">
        <include>
SettingsRadioButtonReversed</include>
        <
label>$LOCALIZE[31510$LOCALIZE[31511]</label>
        <
onclick>Skin.ToggleSetting(Hide.Videos)</onclick>
        <
selected>Skin.HasSetting(Hide.Videos)</selected>
    </
control>
    <
control type="radiobutton" description="Show Update Library Videos">
        <include>
SettingsRadioButtonLevel2</include>
        <
label>$LOCALIZE[31510$LOCALIZE[31530]</label>
        <
onclick>Skin.ToggleSetting(Show.UpdateLibraryVideos)</onclick>
        <
selected>Skin.HasSetting(Show.UpdateLibraryVideos)</selected>
        <
visible>!Skin.HasSetting(Hide.Videos)</visible>
    </
control>
    <
control type="radiobutton" description="Show Video Playlists">
        <include>
SettingsRadioButtonLevel2</include>
        <
label>$LOCALIZE[31510$LOCALIZE[31531]</label>
        <
onclick>Skin.ToggleSetting(Show.PlaylistsVideos)</onclick>
        <
selected>Skin.HasSetting(Show.PlaylistsVideos)</selected>
        <
visible>!Skin.HasSetting(Hide.Videos)</visible>
    </
control>
    <
control type="radiobutton" description="Show Video Files">
        <include>
SettingsRadioButtonLevel2</include>
        <
label>$LOCALIZE[31510$LOCALIZE[31532]</label>
        <
onclick>Skin.ToggleSetting(Show.FilesVideos)</onclick>
        <
selected>Skin.HasSetting(Show.FilesVideos)</selected>
        <
visible>!Skin.HasSetting(Hide.Videos)</visible>
    </
control>
    <
control type="radiobutton" description="Show Videos Search">
        <include>
SettingsRadioButtonLevel2</include>
        <
label>$LOCALIZE[31510$LOCALIZE[31533]</label>
        <
onclick>Skin.ToggleSetting(Show.SearchVideos)</onclick>
        <
selected>Skin.HasSetting(Show.SearchVideos)</selected>
        <
visible>!Skin.HasSetting(Hide.Videos)</visible>
    </
control>
    <!-- 
Options for showing TV SHOWS Menu and Submenu -->
    <
control type="radiobutton" id="102" description="Show TV shows">
        <include>
SettingsRadioButtonReversed</include>
        <
label>$LOCALIZE[31510$LOCALIZE[31512]</label>
        <
onclick>Skin.ToggleSetting(Hide.TVshows)</onclick>
        <
selected>Skin.HasSetting(Hide.TVshows)</selected>
    </
control>
    <
control type="radiobutton" description="Show Update Library TV Shows">
        <include>
SettingsRadioButtonLevel2</include>
        <
label>$LOCALIZE[31510$LOCALIZE[31530]</label>
        <
onclick>Skin.ToggleSetting(Show.TVshows)</onclick>
        <
selected>Skin.HasSetting(Show.TVshows)</selected>
        <
visible>!Skin.HasSetting(Hide.TVshows)</visible>
    </
control>
    <
control type="radiobutton" description="Show Recently Added episodes">
        <include>
SettingsRadioButtonLevel2</include>
        <
label>$LOCALIZE[31510$LOCALIZE[31534]</label>
        <
onclick>Skin.ToggleSetting(Show.RecentlyAddedEpisodes)</onclick>
        <
selected>Skin.HasSetting(Show.RecentlyAddedEpisodes)</selected>
        <
visible>!Skin.HasSetting(Hide.TVshows)</visible>
    </
control>
    <
control type="radiobutton" description="Show Genres">
        <include>
SettingsRadioButtonLevel2</include>
        <
label>$LOCALIZE[31510$LOCALIZE[31549]</label>
        <
onclick>Skin.ToggleSetting(Show.GenresTVshows)</onclick>
        <
selected>Skin.HasSetting(Show.GenresTVshows)</selected>
        <
visible>!Skin.HasSetting(Hide.TVshows)</visible>
    </
control>
    <
control type="radiobutton" description="Show Actors">
        <include>
SettingsRadioButtonLevel2</include>
        <
label>$LOCALIZE[31510$LOCALIZE[31538]</label>
        <
onclick>Skin.ToggleSetting(Show.ActorsTVshows)</onclick>
        <
selected>Skin.HasSetting(Show.ActorsTVshows)</selected>
        <
visible>!Skin.HasSetting(Hide.TVshows)</visible>
    </
control>
    <
control type="radiobutton" description="Show Years">
        <include>
SettingsRadioButtonLevel2</include>
        <
label>$LOCALIZE[31510$LOCALIZE[31550]</label>
        <
onclick>Skin.ToggleSetting(Show.YearsTVshows)</onclick>
        <
selected>Skin.HasSetting(Show.YearsTVshows)</selected>
        <
visible>!Skin.HasSetting(Hide.TVshows)</visible>
    </
control>
</include> 

PHP Code:
<include name="BackgroundsSettings">
    <!-- Default 
Custom Background -->
    <
control type="radiobutton">
        <include>
SettingsRadioButton</include>
        <
label>$LOCALIZE[31580$LOCALIZE[31391]</label>
        <
onclick>Skin.ToggleSetting(CustomBackground.Default)</onclick>
        <
selected>Skin.HasSetting(CustomBackground.Default)</selected>
    </
control>
    <
control type="group" description="Choose Background Default">
        <
visible>Skin.HasSetting(CustomBackground.Default)</visible>
        <
height>120</height>
        <
control type="image" description="Image preview">
            <
left>100</left>
            <
align>left</align>
            <
width>160</width>
            <
texture border="2">$VAR[DefaultBackground]</texture>
            <
aspectratio>keep</aspectratio>
        </
control>
        <
control type="grouplist">
            <
top>15</top>
            <
left>260</left>
            <
width>350</width>                
            <
control type="button" description="Choose Image">
                <include>
SettingsSetCustomBackground</include>
                <
label>$LOCALIZE[31581]</label>
                <
onclick>Skin.SetImage(CustomBackgroundPath.Default)</onclick>
            </
control>
            <
control type="button" description="Choose Folder">
                <include>
SettingsSetCustomBackground</include>
                <
label>$LOCALIZE[31582]</label>
                <
onclick>Skin.SetPath(CustomBackgroundPath.Default)</onclick>
            </
control>
            <
control type="button" description="Reset to default">
                <include>
SettingsSetCustomBackground</include>
                <
label>$LOCALIZE[31583]</label>
                <
onclick>Skin.Reset(CustomBackground.Default)</onclick>
            </
control>
        </
control>    
    </
control>
    <!-- 
Custom Background for Videos -->
    <
control type="radiobutton">
        <include>
SettingsRadioButton</include>
        <
label>$LOCALIZE[31580$LOCALIZE[31511]</label>
        <
onclick>Skin.ToggleSetting(CustomBackground.Videos)</onclick>
        <
selected>Skin.HasSetting(CustomBackground.Videos)</selected>
    </
control>
    <
control type="group" description="Choose Background Videos">
        <
visible>Skin.HasSetting(CustomBackground.Videos)</visible>
        <
height>120</height>
        <
control type="image" description="Image preview">
            <
left>100</left>
            <
align>left</align>
            <
width>160</width>
            <
texture border="2">$VAR[VideosBackground]</texture>
            <
aspectratio>keep</aspectratio>
        </
control>
        <
control type="grouplist">
            <
top>15</top>
            <
left>260</left>
            <
width>350</width>                
            <
control type="button" description="Choose Image">
                <include>
SettingsSetCustomBackground</include>
                <
label>$LOCALIZE[31581]</label>
                <
onclick>Skin.SetImage(CustomBackgroundPath.Videos)</onclick>
            </
control>
            <
control type="button" description="Choose Folder">
                <include>
SettingsSetCustomBackground</include>
                <
label>$LOCALIZE[31582]</label>
                <
onclick>Skin.SetPath(CustomBackgroundPath.Videos)</onclick>
            </
control>
            <
control type="button" description="Reset to Videos">
                <include>
SettingsSetCustomBackground</include>
                <
label>$LOCALIZE[31583]</label>
                <
onclick>Skin.Reset(CustomBackground.Videos)</onclick>
            </
control>
        </
control>    
    </
control>
</include> 

Am I doing something wrong or what I want to do is impossible?

I have an alternative method to show those subordinate settings and I'll use that method if I can't fix this one, but I wanted to know if this should work as intended, because I really like the idea.

I'm sorry for the excessively long post...
Thank you in advance!

Alex


RE: Problem with list scrolling back to the top by itself - MassIV - 2014-04-27

Try numbering all your buttons, including sub buttons, just like any normal button.
So "Show TV shows" would be id="106".


RE: Problem with list scrolling back to the top by itself - Alex... - 2014-04-28

I gave ids to all the buttons in the list as you suggested and now everything works fine without scrolling back to the top.
Thank you very much!