Kodi Community Forum

Full Version: ActivateWindowAndFocus
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying, with zero success,, to create a button to open skin settings and focus on a particular object.

This is the basic structure of my skinsettings.xml file.
PHP Code:
<window>
    <
defaultcontrol always="true">3000</defaultcontrol>
    <
controls>
        <
control type="list" id="3000" description="Left panel - categories">
            <
itemlayout width="415" height="80">
            </
itemlayout>
            <
focusedlayout width="415" height="80">
            </
focusedlayout>
            <
content>
                <
item id="3101" description="Group1">
                </
item>
                <
item id="3102" description="Group2">
                </
item>
            </
content>
        </
control>
        <
control type="group" id="3001" description="Right panel">
            <
control type="grouplist" id="3010" description="Group1">
                <
visible>Container(3000).HasFocus(3101)</visible>
                <
control type="radiobutton" id="3100" description="Button1">
                </
control>
                <
control type="radiobutton" id="3101" description="Button2">
                </
control>
            </
control>
            <
control type="grouplist" id="3080" description="Group2">
                <
visible>Container(3000).HasFocus(3102)</visible>
                <
control type="radiobutton" id="3800" description="Button1">
                </
control>
                <
control type="radiobutton" id="3801" description="Button2">
                </
control>
            </
control>
       </
control>
   </
controls>
</
window

Basic requirement is to set focus on control 3102 in the list container. Bonus if I could also pull focus on a button in group2. Everything I've tried either just opens the window or sends focus off into lala land. thx
Try SetFocus in the windows onload

xml:
<window>
<onload>SetFocus(3000,1,absolute)</onload>
<onload>SetFocus(3080,.... which ever item in group2 you want ....)</onload>
............


</window>
(2021-06-02, 21:34)roidy Wrote: [ -> ]Try SetFocus in the windows onload [..]

Thanks for the input. This, combined with a skin var, would fulfill my basic requirement. Believe that second setfocus is a no go since 3080 is not a container?

Would still like to know why ActivateWindowAndFocus is not behaving as expected.
(2021-06-02, 22:21)nonJon Wrote: [ -> ]Believe that second setfocus is a no go since 3080 is not a container?

Yep, you are right, so just set focus to the control in group 2 you want either 3800 or 3801

Code:
<onload>SetFocus(3800)</onload>
ActivateWindowAndFocus(skinsettings.xml,3000,1,3800,0)

Ah there it is. Was passing a control id where I needed container position. Thanks mate. Talking thru your workaround helped me see the error of my ways. Cheers!