2009-05-06, 15:59
Hi,
I have a simple script which toggles focus between two widgets, a ControlButton and a ControlTextBox.
The script works fine with the version 8.04 live, but if I try to run it from a recent SVN version (e.g. 19917) it gives me an error when trying to give focus to the ControlTextBox.
The error message is:
ERROR: Control 2 in window 13000 has been asked to focus, but it can't
The code is listed below:
Suggestions?
Thanks
I have a simple script which toggles focus between two widgets, a ControlButton and a ControlTextBox.
The script works fine with the version 8.04 live, but if I try to run it from a recent SVN version (e.g. 19917) it gives me an error when trying to give focus to the ControlTextBox.
The error message is:
ERROR: Control 2 in window 13000 has been asked to focus, but it can't
The code is listed below:
Code:
import xbmc
import xbmcgui
class MyDialog(xbmcgui.Window):
def onAction(self, action):
try:
if(action in [1,2,10]):
self.close()
else:
mySelection = self.getFocus()
xbmc.log("The selection is %s" % mySelection)
if (mySelection == self.myButton):
self.myLabel.setLabel("Selecting textbox ")
self.setFocus(self.myTextArea)
elif(mySelection == self.myTextArea):
self.myLabel.setLabel("Selecting button ")
self.setFocus(self.myButton)
except Exception, e:
xbmc.log("Exception: %s" % e)
self.myLabel.setLabel("Exception %s" % e)
def __init__(self):
self.myLabel=xbmcgui.ControlLabel(100,500,1000,50,'start')
self.myButton=xbmcgui.ControlButton(100,10,100,100,"test button")
self.myTextArea = xbmcgui.ControlTextBox(100,200,100,100)
self.addControl(self.myButton)
self.addControl(self.myLabel)
self.addControl(self.myTextArea)
self.setFocus(self.myButton)
myDialog=MyDialog()
myDialog.doModal()
Suggestions?
Thanks