Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Keypress and Keypreview problem
Message
De
07/12/2008 16:55:36
Mike Sue-Ping
Cambridge, Ontario, Canada
 
 
À
06/12/2008 14:44:57
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01365671
Message ID:
01365871
Vues:
15
>>>>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.

Hi Dragan,

Thanks for the reply. I'm am aware of the items that you've described above. In fact, I'm doing exactly what you're saying, i.e., using javascript (onclick, onmouseover, onmouseout, etc.) in addition to using the Navigate method as a callback to VFP to do the heavy lifting (retrieving the data from a VFP database and generating HTML). The thing is, I'm not very good at javascript and would have preferred to find a native VFP solution to detect when a key is pressed and act accordingly.

I was almost there with the form's keypreview and keypress event until the browser control got in the way :)

BTW, do you have any suggestion as to what javascript event I should investigate for a keypress?

Mike
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform