Setting focus in Panel control
#1
Hi,

I'm facing a weird behavior with my code. Because my viewtype is built on the fly (id, name, etc) in an include, the last focused position is lost when window is replaced or closed. Reopening it automatically goes to the first item.

I tried a workaround by setting the position in memory :

Code:
SetProperty(ListPos,$INFO[Container($PARAM[Id]).CurrentItem],Home)

And force the position at window opening (MyXXXNav.xml) :

Code:
<onload condition="!IsEmpty(Window(Home).Property(ListPos))">Control.SetFocus($PARAM[Id],$INFO[Window(Home).Property(ListPos)])</onload>

It works fine excepted when KODI has "Show parent folder item" unselected. Because there is no more "0" item. The focus position results in the last item selected + 1.
Since it's a panel container, using in complement a Control.Move($PARAM[Id],-1) is not correct since it shifts the selection to the upper row instead of the previous item.

If someone has an idea.
Thanks in advance
[Skin] KOver - V1.1.0 Stable (Repo version)
[WIP] ReKOver - Skinning tool project

If I've been helpful or you like my work, hit "THANK USER" button ;) ...
Reply
#2
So Control.Move(ID,-1) is broken for panels?
Reply
#3
I don't think so. It depends the orientation you set.
The fact is Control.Move doesn't move the Item number but the physical place in the panel.
I have here a vertical orientation (because panel is higher than width so it is has more natural feeling to scroll vertically) so Control.Move(ID,-1) moves up.
But previous item is left. When set to Horizontal Control.Move(ID,-1) moves left. but makes the navigation confusing.

Since panel is 2D, for a "real" item number positioning there is an argument missing when !Container.HasParent or previous item could be
Code:
Container.SetFocus(ID,$INFO[Window(Home).Property(ListPos)],-1)
which doesn't exist.

Still, I can have a look at something like Action(Left) or Action(Up) but I'm pretty sure I don't have all conditions available at <onload> level to match the different cases.
[Skin] KOver - V1.1.0 Stable (Repo version)
[WIP] ReKOver - Skinning tool project

If I've been helpful or you like my work, hit "THANK USER" button ;) ...
Reply
#4
Control.Move should only be moving the focus either back or forward an item and not up/down/left/right in panels IMO.
Reply
#5
(2015-09-16, 17:14)Hitcher Wrote: Control.Move should only be moving the focus either back or forward an item and not up/down/left/right in panels IMO.

I would say it depends which definition is given to the action : moving the position or applying an offset to the item number ?
I'm also using the Control.Move(ID,-1) to wrap the panel, for example in a 4 columns x 6 rows

If the item selected item is in position column 2, row 1 and panel is set to vertical : Control.Move(ID,-1) sets focus to column 2, row 6
If the item selected item is in position column 1, row 3 and panel is set to horizontal : Control.Move(ID,-1) sets focus to column 4, row 3

That makes sens.

Then, fixing Control.Move(ID,-1) to offset the item number breaks this rule.
IMO these 2 cases are completely different and there is a missing action to have both ?

A solution could be to define Control.Move(ID,-1) to offset the item number and adding a <wrap>true</wrap> as a new tag in the panel control.
[Skin] KOver - V1.1.0 Stable (Repo version)
[WIP] ReKOver - Skinning tool project

If I've been helpful or you like my work, hit "THANK USER" button ;) ...
Reply
#6
Yes, you're right.
Reply
#7
How about this?

Code:
<onload condition="!IsEmpty(Window(Home).Property(ListPos)) + !Container.HasParent + Container($PARAM[Id].Column(0)">Up</onload>
<onload condition="!IsEmpty(Window(Home).Property(ListPos)) + !Container.HasParent">Left</onload>
Reply
#8
I think you mean down Wink . Thanks Hitcher, will try that. I had something like that in mind but I will have to complete this with changing orientations also. This is going to be a quite long code for an Item-1 ...
[Skin] KOver - V1.1.0 Stable (Repo version)
[WIP] ReKOver - Skinning tool project

If I've been helpful or you like my work, hit "THANK USER" button ;) ...
Reply
#9
Just my 2 cents but is the Control.SetFocus(Id,position) working a logical way ? I mean Control.SetFocus(Id,1) highlights item 2, not 1 (when no parent folder item) so, it doesn't follow the Container.CurrenItem rule. Control.SetFocus(Id,0) should always set the parent folder item or the first item as fallback if not present and Control.SetFocus(Id,1) should always set item 1 ? As I understand this currently work as Control.SetFocus(Id,offset) !
[Skin] KOver - V1.1.0 Stable (Repo version)
[WIP] ReKOver - Skinning tool project

If I've been helpful or you like my work, hit "THANK USER" button ;) ...
Reply
#10
Do your items have ID numbers?
Reply
#11
It's the MyxxxNav.xml Container's autofilled items.
[Skin] KOver - V1.1.0 Stable (Repo version)
[WIP] ReKOver - Skinning tool project

If I've been helpful or you like my work, hit "THANK USER" button ;) ...
Reply

Logout Mark Read Team Forum Stats Members Help
Setting focus in Panel control0