Kodi Community Forum

Full Version: Single lost input in dialogs
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm customising some dialogs at the moment, including the context menu, and whenever I open one the first input is lost. So, if I'm in the video OSD and want to move between options, the first push left or right will be ignored. Am I doing something obvious wrong?
Sounds like when two controls with same id or current control isnt focused first off
Could be your default control isn't visible on load. Can you post the code?
This is literally all that's in DefaultContextMenu.xml at the moment (don't panic, I'm just messing around atm). The includes are just the basic list stuff with conditional positions.

Code:
<?xml version="1.0" encoding="UTF-8"?>
<window>
    <defaultcontrol always="true">6009</defaultcontrol>
    <origin x="0" y="0"></origin>    
    <coordinates>
        <left>0</left>
        <top>0</top>
    </coordinates>
    <controls>
        <control type="image">
            <top>-134</top>
            <left>730</left>
            <width>1190</width>
            <height>67</height>
            <texture colordiffuse="ffebebeb">blank.png</texture>
            <include>Animation_ContextEpisodeOffset</include>            
            <animation type="WindowOpen">
                <effect type="fade" time="200" />
            </animation>                        
        </control>
        <control type="list" id="6009">
            <include condition="Container.Content(episodes)">Element_ContextEpisodeVars</include>
            <include condition="Container.Content(movies) | Container.Content(tvshows)">Element_ContextListVars</include>            
            <orientation>horizontal</orientation>
            <scrolltime>0</scrolltime>
            <focusposition>1</focusposition>
            <onleft>6009</onleft>
            <onright>6009</onright>    
            <defaultcontrol>11</defaultcontrol>                      
        </control>
    </controls>
</window>
I'd call the includes after setting defaultcontrol firstly. Im guessing the includes are the list contents.
I'm still getting this on dialogs for some reason. Now I'm using a custom Settings window (again, dialog) and it's happening there, too. You open the window and it takes precisely one wasted button press before the control gains focus.

Here's the code for that window:

Code:
<?xml version="1.0" encoding="utf-8"?>
<window id="1110" type="dialog">
    <zorder>2</zorder>
    <defaultcontrol>6030</defaultcontrol>
    <controls>
        <control type="list" id="6030">
            <top>830</top>
            <width>1920</width>
            <heignt>250</heignt>
            <movement>6</movement>
            <orientation>horizontal</orientation>
            <defaultcontrol always="true">2</defaultcontrol>
            <scrolltime>0</scrolltime>
            <focusposition>1</focusposition>
            <onleft>6030</onleft>
            <onright>6030</onright>
            <visible>true</visible>
            <animation effect="fade" start="0" end="100" time="250" delay="350">WindowOpen</animation>
            <animation effect="fade" start="100" end="0" time="250">WindowClose</animation>
            <itemlayout width="320" height="250">
                <control type="label">
                    <align>center</align>
                    <top>65</top>
                    <font>aeoncontext</font>
                    <label>$INFO[ListItem.Label2]</label>
                    <textcolor>FFebebeb</textcolor>
                    <shadowcolor>ff000000</shadowcolor>
                    <animation effect="fade" start="0" end="100" time="250" delay="350">WindowOpen</animation>                                
                </control>                                          
                <control type="label">
                    <align>center</align>
                    <top>120</top>
                    <font>franzo25</font>
                    <label>$INFO[ListItem.Label]</label>
                    <textcolor>FFebebeb</textcolor>
                    <shadowcolor>ff000000</shadowcolor>
                    <animation effect="fade" start="0" end="100" time="250" delay="350">WindowOpen</animation>                            
                </control>    
            </itemlayout>
            <focusedlayout width="320" height="287">
                <control type="image">
                    <bottom>35</bottom>
                    <width>320</width>
                    <height>20</height>
                    <texture colordiffuse="ffebebeb">blank.png</texture>
                    <animation effect="fade" start="100" end="100" time="0">WindowOpen</animation>                                        
                </control>                        
                <control type="label">
                    <align>center</align>
                    <top>65</top>
                    <font>aeoncontext</font>
                    <label>$INFO[ListItem.Label2]</label>
                    <textcolor>FFebebeb</textcolor>
                    <shadowcolor>ff000000</shadowcolor>
                    <animation effect="fade" start="0" end="100" time="250" delay="350">WindowOpen</animation>                                    
                </control>                                          
                <control type="label">
                    <align>center</align>
                    <top>120</top>
                    <font>franzo25</font>
                    <label>$INFO[ListItem.Label]</label>
                    <textcolor>FFebebeb</textcolor>
                    <shadowcolor>ff000000</shadowcolor>
                    <animation effect="fade" start="0" end="100" time="250" delay="350">WindowOpen</animation>                                    
                </control>                        
            </focusedlayout>                        
            <content>
                <item id="11">
                    <label>[B]General[/B][CR]Basics • Animation</label>
                    <label2>a</label2>                            
                    <onclick>SetFocus(70)</onclick>
                    <visible>true</visible>                            
                </item>
                <item id="13">
                    <label>[B]Home[/B][CR]Wallpaper • Menu</label>
                    <label2>f</label2>                            
                    <onclick>UpdateLibrary(video)</onclick>
                    <onclick>UpdateLibrary(tvshows)</onclick>                                
                    <visible>true</visible>                            
                </item>
                <item id="13">
                    <label>[B]Movies & TV[/B][CR]Artwork • Info Panel</label>
                    <label2>f</label2>                            
                    <onclick>UpdateLibrary(video)</onclick>
                    <onclick>UpdateLibrary(tvshows)</onclick>                                
                    <visible>true</visible>                            
                </item>
                <item id="14">
                    <label>[B]Music[/B][CR]Artwork • Playback</label>
                    <label2>a</label2>                            
                    <onclick>ActivateWindow(settings)</onclick>
                    <visible>true</visible>                            
                </item>                                                    
                <item id="15">
                    <label>[B]Games[/B][CR]Layout • Metadata</label>
                    <label2>R</label2>                            
                    <onclick>ReloadSkin()</onclick>
                    <onclick condition="String.IsEmpty(Weather.Plugin)">ReloadSkin()</onclick>
                    <visible>true</visible>                            
                </item>
                <item id="16">
                    <label>[B]Playback[/B][CR]Presentation • OSD</label>
                    <label2>c</label2>                            
                    <onclick>ReloadSkin()</onclick>
                    <onclick condition="String.IsEmpty(Weather.Plugin)">ReloadSkin()</onclick>
                    <visible>true</visible>                            
                </item>                                    
            </content>
        </control>                                                    
    </controls>
</window>
try

Code:
<onload>SetFocus(6030)</onload>

also try removing

Code:
<visible>true</visible>

as list may not be visible quick enough to set focus, so is getting set before visible gets checked, dialogs can be a bit slow imho.
Tried both but the problem persists.
the list control is not visible when the dialog opens, so it can't be focused.

you'd need to remove the delay from the WindowOpen animation.
Smile
Yup, that was it. Thanks!
Okay, so removing the delay fixes the problem, but now I'm not sure how to replicate the effect. I need the list to fade in after 350ms, and applying the animation to the list item labels, etc, has no effect...

EDIT: nm, fixed it by using a dummy button with a fade-in of 350ms, which then passes focus to the list.
Or could draw it off screen then animate into position with 0 time and 350 delay.