Microsoft KB Archive/177336

= PRB: READ EVENTS in Form's Init Causes the Form Not to Display =

Article ID: 177336

Article Last Modified on 5/10/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition
 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a
 * Microsoft Visual FoxPro 6.0 Professional Edition
 * Microsoft Visual FoxPro 3.0b for Macintosh

-



This article was previously published under Q177336



SYMPTOMS
A form does not display when you run the form.



CAUSE
If you issue a READ EVENTS in the Init or Load event, the form does not get a chance to display before going into the event loop.



RESOLUTION
Here are two resolutions:  Place the READ EVENTS command in a method other than Init or Load. -or-

  Use the ON KEY LABEL command to issue a CLEAR EVENTS. For example, place the following command in the Init event of the form: ON KEY LABEL ALT+X CLEAR EVENTS 

and In the Destroy event of the form place the following command: ON KEY LABEL ALT+X Now, after you run the form, when program execution stops at the READ EVENTS, you can press the ALT+X keys to clear the READ EVENTS and continue with program execution.



STATUS
This behavior is by design.



Steps to Reproduce Behavior
  Create and run a FoxPro program with the following code: frmForm=CREATEOBJECT('frmformTest') frmForm.SHOW

DEFINE CLASS frmFormTest AS FORM VISIBLE=.T.     WINDOWTYPE=1

PROCEDURE INIT **Comment the following line to see form. READ EVENTS ENDPROC

PROCEDURE CLICK CLEAR EVENTS ENDPROC ENDDEFINE NOTE: If you issue READ EVENTS in an event or a method of a form, then you need to issue CLEAR EVENTS before the form can be closed. 

Additional query words: read events clear event form disappear

Keywords: kbprb KB177336

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.