Mariano,
From: Mariano Di Felice [mailto:mariano.difelice@gmail.com]
Sent: Wednesday, September 19, 2007 11:41 AM
To: wxPython-users@lists.wxwidgets.org
Subject: Re: [wxPython-users] ActiveX_IEHtmlWindow tab
traversal crashesHi Mike,
I have found this problem too, but I've solved!!
The problem is about ActiveX, which it's contained in a
panel, or frame, or dialog....
If you press any key ( not only tab!! ;-( ), this window crashes.I've solved inserting a wx.TextCtrl into container ( frame,
dialog or panel ).
Then, I have hidden it and I have setted focus.class MyFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, "TEEEEEST")
self.ie = iewin.IEHtmlWindow(self, -1,
style=wx.NO_FULL_REPAINT_ON_RESIZE)
self.ie.LoadUrl("http://www.libero.it" <http://www.libero.it> )
tmp = wx.TextCtrl(self, -1, "")
tmp.Hide()
tmp.SetFocus()I assure you that it works!!
It's not beautiful solution, but it works...bye
While this does solve the problem of the application crashing (unless I
tab twice), it doesn't solve my problem of wanting to manipulate a web
form that I've loaded. I still need to physically point my mouse somewhere
in the browser control and click on it to make it have the focus so that I
can use the SendKeys module to enter data into the web form.
This ActiveX_IEHtmlWindow widget seems to have another odd issue. After
filling out the web form, I have my script submit the data and the browser
widget loads a second page. I then call the GetText() method, but it
always returns the html from the first page and not the second. I've tried
calling GetText() with wx.CallAfter() as well, but that doesn't work
either.
Here are my methods for all you wonderful people to pick apart:
<code>
def onRun(self, event):
self.ie.SetFocus()
licence_lst = ['000BWA']
for licence in licence_lst:
letters = list(licence)
for letter in letters:
SendKeys('{%s}' % letter)
SendKeys('{TAB}')
start_date = list('06/12/2007')
for char in start_date:
SendKeys('{%s}' % char)
SendKeys('{TAB}')
end_date = list('06/12/2007')
for char in start_date:
SendKeys('{%s}' % char)
SendKeys('{ENTER}')
wx.CallAfter(self.getHtml())
def getHtml(self):
print self.ie.GetText()
</code>
Currently running wxPython 2.8.4.2, Python 2.4, Windows XP
Thanks,
Mike
···
-----Original Message-----