I have a question regarding 2.5.1.5 and iewin.IEHtmlWindow (on Python
2.3 and Windows XP, if that matters).
I'd like to be able to "catch" hyperlink-clicks on the IE rendered HTML and, depending on the link clicked, either:
1. change the HTML on display (provide IE with new
HTML as string); or
2. show a wizard or other dialog
I've figured out that I need to catch IE's 'OnBeforeNavigate2' events and:
1. set evt.Cancel to True, stopping IE from further
processing of the url
2. Use the LoadString() method to change the rendered
HTML
3. Or just launch the dialog/wizard ...
Point 3 has me a bit worried. Its working but I'm wondering what's happening with all the event loops. The dialog will need an event loop, but I'm obviously getting a call out from an event loop ...
So, will this starting an event loop from inside an event loop callback approach start to have problems later? Is there some more robust way of doing this? Perhaps its all just find as is?
My (rather straight-forward) code for OnBeforeNavigate2() is here:
def OnBeforeNavigate2(self, evt):
# Cancel IE's URL load, we'll look after it
evt.Cancel = True
# now process the URL
if evt.URL == "http://changeHTML/":
self.ie.LoadString(anHTMLstring)
else:
dlg = wx.MessageDialog(self, 'Hello from OnBeforeNav2()',
'A Message Box', wx.OK | wx.ICON_INFORMATION)
dlg.ShowModal()
dlg.Destroy()
Cheers,
Mike