We have embedded Mozilla 1.3.1 in an MFC (Windows) app. (We chose 1.3.1 for 
compatibility with old macs.) It's running fine in most respects.

I'm unable, however, to make the IWebBrowserFocus interface work. This is 
the code I'd like to run:

    nsCOMPtr<nsIWebBrowserFocus> focus(do_GetInterface(m_pWebBrowser));
    ASSERT(focus);
    focus->SetFocusAtFirstElement();

Executing that code seems to have no effect. I've loaded an HTML page with a 
<FORM> and some radio button inputs. I expect SetFocusAtFirstElement to put 
the keyboard input focus on the first radio button, but it does not move the 
focus at all.
I've tried the other methods on IWebBrowserFocus to no better effect. For 
example, I've enumerated the DOM, found my input elements, and tried to set 
the focus explicitly with SetFocusedElement. No luck.

As a temporary workaround I'm enumerating the windows Mozilla creates and 
using the Windows API to set focus on one of them directly. That 
works--except on Windows 98, where it seems to be causing a crash for 
reasons that aren't yet clear. So we'd much prefer to use IWebBrowserFocus 
if possible.

We are calling nsIWebBrowserFocus::Activate and Deactivate whenever our main 
window is activated or deactivated. A source code comment suggested not 
doing so might have bad effects. Are there other requirements I need to meet 
in order for the SetFocus mechanism to work?

Brian 


_______________________________________________
mozilla-embedding mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-embedding

Reply via email to