Kodi Community Forum
Cguiwindow::getfocuscontrol() doesnt return id - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93)
+--- Thread: Cguiwindow::getfocuscontrol() doesnt return id (/showthread.php?tid=8589)



- Asteron - 2004-12-28

in my python script i noticed xbmcgui.window.getfocus() was not returning the correct control. i traced this problem to

guilib/guiwindow.cpp
Quote:int cguiwindow::getfocuscontrol()
{
for (int i=0; i < (int)m_veccontrols.size(); ++i)
{
cguicontrol* pcontrol= m_veccontrols[i];
if (pcontrol->hasfocus()) return i;
}
return -1;
}

it is returning the control index
lib/libpython/xbmcmodule/window.cpp - window_getfocus() assumes it is returning the control id. does any other code use this function and is counting on a control index?

i think the line should be changed to
Quote: if (pcontrol->hasfocus()) return pcontrol->getid();

i'd do the fix myself but dont have an environment setup (traced this just by browsing the cvs on sourceforge).


- Bobbin007 - 2004-12-28

there is a function called getfocusedcontrol(). this returns the id of the focused control.

greets

bobbin007


- Asteron - 2004-12-28

lol ok... then the bug is just in

xbmc/lib/libpython/xbmcmodule/window.cpp - window_getfocus()

Quote:...
icontrolid = pwindow->getfocuscontrol();
...

should be

Quote:...
icontrolid = pwindow->getfocusedcontrol();
...

can someone make the fix? thanks

-ast


- Bobbin007 - 2005-01-02

fixed in cvs forgotten to reply Blush

greets

bobbin007