Microsoft KB Archive/178666

= BUG: Form Not Released When Focus on Grid and Modal Form Started =

Article ID: 178666

Article Last Modified on 5/12/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 Q178666



SYMPTOMS
A form, on which a grid has focus, remains visible after the form has been programmatically released and a modal form has been instantiated. The form containing the grid remains visible until the modal form has been released.



RESOLUTION
Set the visible property of the form containing the grid to False (.f.) before releasing the form, using the following code: PROCEDURE closescreens IF _SCREEN.FORMCOUNT > 0 FOR i = _SCREEN.FormCount TO 1 STEP -1 _SCREEN.FORMS(i).VISIBLE=.F.  _SCREEN.FORMS(i).RELEASE ENDFOR ENDIF RETURN



STATUS
Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.



MORE INFORMATION
This behavior is not observed when a form, containing a grid object, is programmatically released under the following conditions:


 * A grid object does not have focus.
 * The WindowType property of the form being instantiated, after release of the form containing the grid, is set to 0 - Modeless.

Steps to Reproduce Behavior
 Create a form called gridfrm and place a grid object on the form. Create a second form called modalfrm and set its WindowType property to 1 - Modal.  Add the following code to the forms Click event: =endjob   Create a program file named Norelease.prg using the following code: CLEAR SET SYSMENU TO     SET SYSMENU AUTOMATIC DEFINE PAD modal_frm OF _MSYSMENU PROMPT "\ 0 FOR i = _SCREEN.FORMCOUNT TO 1 STEP -1 _SCREEN.FORMS(i).RELEASE ENDFOR ENDIF RETURN

PROCEDURE runmodal =closescreens DO FORM modalfrm RETURN

PROCEDURE endjob =closescreens CLEAR EVENTS RETURN  Run Norelease.prg.</li> Click the Modal Form menu item.</li></ol>

Keywords: kbbug kbcode KB178666

-

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

© Microsoft Corporation. All rights reserved.