PRB: CLEAR EVENTS in Modal Form Does Not Clear a READLast reviewed: April 4, 1996Article ID: Q130387 |
The information in this article applies to:
SYMPTOMSA modal form is run from a program with a DO FORM command followed by a READ EVENTS. A command button on the form has the following method in its Click event:
RELEASE THISFORM CLEAR EVENTSWhen the button is clicked, the form is released but the READ EVENTS is not cleared.
CAUSEWhen a modal form is displayed, execution of a program is suspended. Modal forms do not require a READ EVENTS. In the case described in this article, the READ EVENTS command has not yet been executed when the CLEAR EVENTS is issued. Program execution is suspended.
RESOLUTIONDo not use the READ EVENTS command if you have a modal form or form set. To verify the modality of your form, check the value of the WindowType property. When a form is modal, the WindowType property is equal to 1. For more information about displaying modal forms or form sets, search for the WINDOWTYPE property or the SHOW method in the Visual FoxPro Help menu.
STATUSThis behavior is by design.
MORE INFORMATION
Steps to Reproduce BehaviorThe following sample code displays a modal form. When the form is displayed and the command button is clicked, the form is released, but control does not return to the Command window. To correct this sample, remove the READ EVENTS and CLEAR EVENTS commands from the code.
omyform=CREATEOBJECT('myform') omyform.Show(1) && Displays a modal form READ EVENTS DEFINE CLASS myform AS form WindowType=0 ADD OBJECT mycmd AS CommandButton PROCEDURE mycmd.Click RELEASE Thisform CLEAR EVENTS ENDPROC ENDDEFINE |
Additional reference words: 3.00 VFoxWin
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |