Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Close form by pressing ESC
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01538616
Message ID:
01538851
Views:
152
Likes (1)
KeyPreview doesn't work from the Web Browser control. When the WebBrowser has control your FoxPro keystroke events are not getting processed as you are effectively inside of that 'window'. In order to capture events you need to handle the browser's DOM events.

You can call JavaScript functions from FoxPro code and pass in a reference to the FoxPro form, then call that from script code for example.

Here's some basic info on calling JavaScript code in the Web Browser control:

http://www.west-wind.com/weblog/posts/2008/Sep/27/Calling-JavaScript-functions-in-the-Web-Browser-Control

+++ Rick ---

>Hi everybody,
>
>I have a form with Web Browser control taking all the form. I set KeyPreview property to .t. and added a code in KeyPress event
>
> if nKeyCode = 27
>   thisform.release()
>endif
>
>However, pressing ESC doesn't close the form. Do you know how can I make this form to close on ESC?
>
>Thanks in advance.
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform