Tab traversal in embedded IE webbrowser with MakeActiveXClass

David Bolen <db3l@fitlinxx.com> writes:

I'm embedding IE under a wxPython application on Windows (wxPython
2.4.1.2) and have run into an issue with special key handling (tab
traversal, backspace to go back a page, etc...) not functioning within
the embedded control.

I've been able to find a handful of questions about this in older list
postings, but without really seeing anyone with an actual solution
shown.

Apparently this is intended behavior for the webbrowser control in
that as an embedded control it doesn't handle keys like tab internally
by default, but instead assumes that tab traversal would be including
the entire webbrowser control as part of a larger sequence of controls
in the container object.

There are some articles in MSDN that discuss how you have to supply
those keys to the underlying control, but obviously they are focused
on MFC or straight C++ applications (which shows a fix involving the
main message pump loop), and I'm not sure if there's a way to translate
that to the wxPython wrapper level.

I think the most appropriate approach for the wxPython wrapper is to
somehow get the IOleInPlaceActiveObject interface and call its
TranslateAccelerator method.

I don't know whether this helps or not, but Henk Punt's venster library
at least contains Python code which does this. IIRC, it's the
test_browser sample.

Thomas