PRB: Form's KeyPress Is Not Fired When ActiveX Control Has Focus (200266)
The information in this article applies to:
- Microsoft Visual FoxPro for Windows 3.0
- Microsoft Visual FoxPro for Windows 3.0b
- Microsoft Visual FoxPro for Windows 5.0
- Microsoft Visual FoxPro for Windows 5.0a
- Microsoft Visual FoxPro for Windows 6.0
- Microsoft Visual FoxPro for Windows 7.0
This article was previously published under Q200266 SYMPTOMS
You have a form with code in the KeyPress event and the KeyPreview property is set to true (.T.). When an ActiveX control has focus, the KeyPress event of the form does not fire.
CAUSE
The KeyPress event for many ActiveX controls happens to have the same name as the Visual FoxPro native KeyPress event. ActiveX controls on Visual FoxPro forms also have their own window. As a result, they handle the KeyPress event independently of Visual FoxPro.
RESOLUTION
In the KeyPress of the ActiveX control, add the following code as the first line of the event:
ThisForm.KeyPress
STATUS
This behavior is by design.
Modification Type: | Major | Last Reviewed: | 5/12/2003 |
---|
Keywords: | kbBug kbCodeSnippet kbCtrl kbnofix kbprb KB200266 kbAudDeveloper |
---|
|