XML Window script - help needed
#1
Hi, I have button controls defined in a window xml file. I want to set navigation from python, possible?

When I try using controlDown it doesn't work. Am I correct that it is because the control is defined in the xml and not done from python?

So.. next I try -
Code:
<onup>$INFO[Window.Property(navControl)]</onup>
<ondown>$INFO[Window.Property(navControl)]</ondown>
but this needs to be an int not a string.

Thanks for any thoughts.
Reply
#2
Ahh... Think I got it.

Seems I needed to init the controls in my window class before displaying the window, then set the navigation.

For the record the error was -

Non api type passed to "setNavigation" in place of the expected type "p.XBMCAddon::xbmcgui::Control."
Reply
#3
New problem...

Trying to setFocus on on a list control with list items fails -
Code:
ERROR: Control 1288 in window 13000 has been asked to focus, but it can't

Code:
<control type="list" id="1288">
            <description>filter dialog</description>
            <width>300</width>
            <height>400</height>
            <visible>Skin.HasSetting(FilterDialog)</visible>
            <itemlayout width="320" height="29">
                <control type="label">
                    <width>300</width>
                    <height>22</height>
                    <font>font13</font>
                    <aligny>center</aligny>
                    <align>left</align>
                    <info>ListItem.Label</info>
                    <textcolor>ffa9a9a9</textcolor>
                </control>
                <control type="image">
                    <posy>60</posy>
                    <posx>0</posx>
                    <width>300</width>
                    <height>29</height>
                    <texture>not_selected_bak.png</texture>
                </control>
            </itemlayout>
            <focusedlayout width="300" height="29">
                <control type="label">
                    <width>300</width>
                    <height>22</height>
                    <font>font13</font>
                    <aligny>center</aligny>
                    <align>left</align>
                    <info>ListItem.Label</info>
                </control>
                <control type="image">
                    <posy>60</posy>
                    <posx>0</posx>
                    <width>300</width>
                    <height>29</height>
                    <texture>selected_bak.png</texture>
                </control>
            </focusedlayout>
        </control>


self.setFocus(self.filter_dialog)
xbmc.executebuiltin("SetFocus(1288)")
xbmc.executebuiltin("SetFocus(1288, 0)")

All give the same error. Any ideas?
Reply
#4
one of the reasons this could happen is that the list is (still) empty when you try to focus it.
test if adding some sleep between populating the list and setting focus fixes it.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#5
@ronie, thanks that did the trick.

I have another issue now...

After playing a video or tabbing(display key) between the player and the script/window, the script/window restarts.

I don't think this the expected behaviour, or is it?

Thanks for any thoughts.
Reply
#6
i'm not sure, i've never tried anything like that.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#7
For the record, I found that it's onInit() that gets called when switching focus from the player back to the window.
Reply

Logout Mark Read Team Forum Stats Members Help
XML Window script - help needed0