Kodi Community Forum
Overriding controls on certain widgets? - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: Overriding controls on certain widgets? (/showthread.php?tid=10411)



- seven5 - 2005-03-06

hey guys, i'm about finished with my bloglines script, but its a bit hard to navigate it. i'm using lists for everything and its due to the way they work, i cant do certain things.

Image

i have to press "left" to get to the item list, since pressing right will take me to the "page up/down" part of the widget. also, i can't even get to the textbox below the itemlist because of the same contraints.

anyone have any ideas?

i'm hoping to post this tonight, so any help would be great. thanks!


- Asteron - 2005-03-06

dummy up the navigation... it looks like you only have three controls (two lists and the text area) and just add action listeners for move_right and move_left and cause it to do

if action = move_right:
if selectedcontrol = list1 :
selectedcontrol = list2
window.setfocus(list2)

its hackish but it works. i do it in my xstocks script and its done in the launchbrowser too im pretty sure.


- seven5 - 2005-03-06

ok, great. that sounds like a great solution, i'll check it out.


- seven5 - 2005-03-06

ok, i'm having a heck of a time trying to detect what control currently has focus. i looked at your script and launchbrowser as well, and don't see where you guys are testing for the current control.

this is about what i think i need:

Quote: if action == action_move_right and self.getfocus() == mydisplay.feedlist:
self.setfocus(self.itemlist)


honestly i dont see how .getfocus() works.. fromt he docs:
Quote:getfocus(...)
getfocus(self, control) -- returns the control which is focused.

if it returns what is focused, why do you pass in a control?? how does that work.

thanks


- Asteron - 2005-03-06

getfocus() sucks. there was a bug earlier where it would return a random control but even the new code doesnt seem to give you the right python controls. i think it may be returning the internal controls or something. i was never able to get it working and its not a good idea since there are people with older builds who still have the broken getfocus().

in your init do

self.selectedcontrol = list1
self.setfocus(list1)

dont do and controlright controlleft stuff and in onaction do

if action == move_right:
if self.selectedcontrol = list1
self.selectedcontrol = list2
self.setfocus(list2)
elif self.selectedcontrol = list2
self.selectedcontrol = textarea
self.setfocus(textarea)
etc etc

if action == move_left:
etc etc

this way you dont have to use getfocus or the controlright controlleft stuff.