Tab key ignored in WebBrowserComponent(Windows)


#1

Hi.

It appeared to be a common issue regarding ActiveX + IE.
We need to call TranslateAccelerator() so the IE will be able to process the tab key.

I’m new to Windows/ActiveX programming so I don’t really know where is the place in the code to do it.

I saw some snippets of code that do it in a CALLBACK functions like the CALLBACK activeXHookWndProc() in juce_win32_ActiveXComponents,
others do it in a HHOOK objects.

I tried but failed to add it to Juce.

Plz help.


#2

Looks like the callback should be attached using this block:

WNDCLASSEX wc;
::ZeroMemory (&wc, sizeof(WNDCLASSEX));
wc.cbSize = sizeof(WNDCLASSEX);
wc.hInstance = instance_;
wc.lpfnWndProc = this->WindowProc; <- attaching the callback
wc.lpszClassName = “subkdls490”;
RegisterClassEx(&wc);

Where do I add it in Juce??

Thanks


#3

You can’t just create a new window class - the window already has a class! I guess I’d have to add the TranslateAccelerator call somewhere in the normal wndproc routine. How is it supposed to be called?


#4

In the callback you need to add a OnKeyDown() function to a WM_KEYDOWN event
that looks something like this:

LRESULT OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
CComQIPtr<IOleInPlaceActiveObject, &IID_IOleInPlaceActiveObject>
pIOIPAO(browser);
HRESULT hr = S_FALSE;

if ( pIOIPAO )
{
	MSG msg;
	msg.message = uMsg;
	msg.wParam = wParam;
	msg.lParam = lParam;

	hr = pIOIPAO->TranslateAccelerator(&msg);
}
return hr;

}


#5

wow… not really sure how it’d be best to crow-bar that into it…

To add it would mean that the normal win32 stuff would have to have a special case for detecting the activex comps - all a bit messy!


#6

I agree.
I don’t mind doing it quick and dirty for now.
Can you suggest me a way to grab the browser in the peerWindowProc(), that’s all I’m missing:

case WM_KEYDOWN:

IOleInPlaceActiveObject* ipao;

IWebBrowser2 browser = / get the browser /
browser->QueryInterface(IID_IOleInPlaceActiveObject, reinterpret_cast<void
*>(&ipao));
if (ipao) {
MSG m;
m.message=WM_KEYDOWN;
m.wParam = wParam;
m.lParam = lParam;
m.hwnd = hwnd;
ipao->TranslateAccelerator(&m);
}

Thanks.


#7

I guess you might be able to use win32 calls to find a suitable child HWND, then find its ComponentPeer, get its component and then attempt a dynamic_cast <WebBrowserComponent*>… all pretty icky, I’m afraid!


#8

Thanks, I’ll try it.


#9

Shlomi: Did you manage to create a working fix for this issue?

jules: Any chance of getting an official fix for this in the juce codebase?

We’ve run into the problem when we use a browser component showing a web page where there’s form fields to fill with info. Not being able to tab between the fields rather breaks the user experience I’m afraid…


#10

I’ve no time to investigate it myself right now, but if anyone can suggest a good fix for it, I’d certainly be happy to look at that.


#11

Hi Markus.

It’s still in my to-do list, sorry.


#12

Ah, too bad. Thank you anyways.


#13

Hi,

Is the issue fixed ?

Thanks,


#14

I believe so, testing on Windows 10 the tab key works as expected in WebBrowserComponent.


#15

Oh did u test on reaper?

I have another issue, WWebBrowserComponent do not send key event => ajax on web site does not work