PRB: Some OLE Control Events Do Not Fire in Visual FoxPro 3.0bLast reviewed: February 26, 1997Article ID: Q143303 |
3.00b
WINDOWS
kbinterop kbprb
The information in this article applies to:
SYMPTOMSUnder certain circumstances, user code attached to events of OLE Controls may not execute. In particular, if you click a control while user code of another control is running, the OLE control seems to get the focus. However, the user code associated with the Click event is not called. This article explains why this behavior may happen.
CAUSEVisual FoxPro regularly calls the Windows API PeekMessage to handle function keys and ON KEY LABEL. Calling PeekMessage yields Visual FoxPro processing and allows the OLE control to trigger the event. However, the firing of the event fails, and this behavior is not handled by the OLE control.
STATUSThis behavior is by design.
MORE INFORMATIONIn xBase a user has the ability to assign commands to Hot-Keys, or ON KEY LABEL (OKL).The command associated with OKLs is called as soon as the key is pressed, no matter what is happening in Visual FoxPro. In the following example program, pressing the F5 key stops the execution of the program and immediately calls the statement assigned to the OKL. Once the OKL command is completed, Visual FoxPro resumes the program.
ON KEY LABEL F5 ?MESSAGEBOX("Hello World") FOR i = 1 TO 1000000 ENDFORTo support this behavior, Visual FoxPro calls the Application Program Interface (API) PeekMessage() between each execution of a command. In the previous case, Visual FoxPro calls PeekMessage between the FOR command and the ENDFOR command. Visual FoxPro also calls PeekMessage() when it is executing a query or indexing a big table because users may press the ESC key to interrupt and halt the command. If Visual FoxPro didn't call PeekMessage, it wouldn't see the key until it's too late. Calling PeekMessage yields Visual FoxPro processing and gives an OLE control a chance to look at its message queue and trigger events. However, at that time, Visual FoxPro does not handle the firing of an event because it is looking for key messages that are defined with OKLs. Visual FoxPro thus fails the firing of the control event. Visual FoxPro fails the firing of the event in two different situations.
Steps to Reproduce Behavior
|
KBCategory: kbinterop kbprb
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |