Kodi Community Forum
Control.SetFocus(id,position) is not working for panel? - 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: Control.SetFocus(id,position) is not working for panel? (/showthread.php?tid=129057)

Pages: 1 2


Control.SetFocus(id,position) is not working for panel? - slinuxgeek - 2012-04-16

In MyMusicNav.xml I have writen:
<onload condition="isVisible(51)">Control.SetFocus(51,2)</onload>

That means I want that when the songs are visible in list panel container , highlight 2nd item of list.
2nd item is 1st song in the view because 1st item is ".." .

I want instead of ".." the item next to ".." should be highlighted when ever the window opens.

Control.SetFocus(51,2) is not working.

51 is id of panel container.

how can I do that?

Thanks of help.


RE: Control.SetFocus(id,position) is not working for panel? - Hitcher - 2012-04-16

Use this instead so it only moves when focused on the Parent Folder item -

Code:
<onload condition="StringCompare(ListItem.Label,..) + Control.IsVisible(51)">Control.Move(51,1)</onload>



RE: Control.SetFocus(id,position) is not working for panel? - Jezz_X - 2012-04-16

You do know that this is going to screw with people who actually go and turn off the show parent items thing right ? not to mention when you go to full screen playback and back again you will lose the current focus


RE: Control.SetFocus(id,position) is not working for panel? - slinuxgeek - 2012-04-16

Then how can we do it Jezz_x?

I don't understand why this function is not working ?
Control.SetFocus(51,2)
is it for any other purpose?


Thanks for Help.


Control.SetFocus(id,position) is not working for panel? - pecinko - 2012-04-16

Try just setfocus. (without control. )


RE: Control.SetFocus(id,position) is not working for panel? - slinuxgeek - 2012-04-16

@pecinko it did not work !!



RE: Control.SetFocus(id,position) is not working for panel? - Hitcher - 2012-04-16

I know my method works with no problems because I tested it.


RE: Control.SetFocus(id,position) is not working for panel? - butchabay - 2012-04-16

(2012-04-16, 11:42)slinuxgeek Wrote: In MyMusicNav.xml I have writen:
<onload condition="isVisible(51)">Control.SetFocus(51,2)</onload>

That means I want that when the songs are visible in list panel container , highlight 2nd item of list.
2nd item is 1st song in the view because 1st item is ".." .

I want instead of ".." the item next to ".." should be highlighted when ever the window opens.

Control.SetFocus(51,2) is not working.

51 is id of panel container.

how can I do that?

Thanks of help.

You wrote:

<onload condition="isVisible(51)">Control.SetFocus(51,2)</onload>

Forgot something ? Just to be sure ... maybe ?

PHP Code:
<onload condition="Control.IsVisible(51)">Control.SetFocus(51,2)</onload




RE: Control.SetFocus(id,position) is not working for panel? - slinuxgeek - 2012-04-17

Hi every one Thanks for reply , but none of the above code worked for me Sad .
Code of MyMusicNav.xml:
PHP Code:
<window id="502">
<
onload>Skin.SetString(choice1,"Music")</onload> <!-- for other purpose-->

<!-- 
I wrote only one out of three which is below at a time but no help-->
<!--
This did not work-->
<
onload condition="StringCompare(ListItem.Label,..) + Control.IsVisible(51)">Control.Move(51,1)</onload>

<!--
This also did not work-->
<
onload condition="Control.IsVisible(51)">Control.SetFocus(51,2)</onload

<!-- 
Not even this-->
<
onload>Control.Move(51,2)</onload>

    <
defaultcontrol always="true">19</defaultcontrol> <!-- I tried to comment it also but no help -->
    <
allowoverlay>no</allowoverlay>
    <
views>51,53</views>
    <
controls>
        <
control type="group">
            <!-- 
panel control to display songs-->
            <include>
ViewVisibleEffect</include>
            <include>
CommonExtra_Info</include>
            <include>
CommonRootView_Info</include> <!-- view id 51 -->
            <include>
ThumbnailView</include> <!-- view id 53 -->
            <include>
ScrollOffsetLabel</include>
        </
control>
        <include>
TopControlsPanel</include>
        <include>
BottomControlsPanel</include>
    </
controls>
</
window

Thanks.


RE: Control.SetFocus(id,position) is not working for panel? - Hitcher - 2012-04-17

It'll only work if CommonRootView_Info is the first view you see when opening Music, if drill down deeper into the folders (ie Albums, Songs) it wont because MyMusicNav is already open.


RE: Control.SetFocus(id,position) is not working for panel? - slinuxgeek - 2012-04-17

I agree but it is not working even first time when CommonRootView_Info is the first view.

Also when drill down deeper into the folders (ie Albums, Songs) I want it to work in the same way ,
this will not work here because of <onload> because window is already loaded but then there should be some other way.

Thank You.


RE: Control.SetFocus(id,position) is not working for panel? - Hitcher - 2012-04-17

Best to forget about it and let the user decide if they want to hide the parent folder item altogether.


RE: Control.SetFocus(id,position) is not working for panel? - slinuxgeek - 2012-04-17

Sad Sad


RE: Control.SetFocus(id,position) is not working for panel? - `Black - 2012-04-17

Why do you want to force users to have ".." hidden? You shouldn't do that, everyone can disable it in the settings if he doesn't need it. Just add this to your skin description that you have your own buttons for going back and users should hide parent folder items if they want the best skin experience.


RE: Control.SetFocus(id,position) is not working for panel? - slinuxgeek - 2012-04-18

OK `Black .

Oh wait this thread was not about hiding the ".." item but , it was about how to highlight the first actual item when user enters the window.
instead of highlighting ".." the item next to ".." should be focused / highlighted .
If ".." is not there (hidden by user) no problem , the first actual item should be focused always.

Please help , I need it.