>>>I've got a web browser control on a VFP form whose keypreview is set to .T. I've put code in the form's keypress and I've discovered that the code does not execute because of the web browser control. I've tested this scenario with another activeX control and the same thing happens. If I remove the activeX control, the form's keypress code fires.
>>>
>>>Has anyone encountered this and know of a workaround?
>>>
>>>What I'm trying to do is implement some keyboard shortcuts like F5 to refresh the content displayed in the web browser.
>>>
>>>TIA,
>>>Mike
>>
>>I found this message
Re: Function Key and Calendar Control Thread #
842812 Message #
842914 seems to be related.
>
>Thanks Naomi. Unfortunately the browser control does not have any key events that I can see to trap!
But the document in it does. You may add
onContextMenu="rclick(event);" onChange="changed(this);"
or something of the kind to any element in the DOM of the document, and then have the Javascript functions pass the info to the browser control as a suitable URL that you can catch in oBrowser.Navigate() (because it's literally a
control that you control :). You set cancel=.f. so it doesn't actually go anywhere, it's just your callback function.
If the javascript functions and on* properties of the elements in the page aren't there, you can insert them invisibly when the page loads. It's under your control via DOM, you can set properties, insert text (visible or not), insert elements, hide and show... you run the show, you can add the script and make it be called, all in the two microjiffies between page load and actually letting the user see it.