Microsoft KB Archive/138563

= FIX: Form Not Cleared from Memory When Grid Has the Focus =

Article ID: 138563

Article Last Modified on 9/30/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition

-



This article was previously published under Q138563



SYMPTOMS
The RELEASE command will not release a form from memory if a grid has the focus when the form is released. The form is cleared off the screen, but _screen.formcount is not decremented, and _screen.activeform.name still shows the name of the form in the Debug window. If another object on the form, such as a text box, has the focus when the form is released, _screen.formcount is decremented, and _screen.activeform.name is cleared.



STATUS
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem has been fixed in Visual FoxPro 5.0 for Windows.



Steps to Reproduce Problem
  Create s program named Main.prg that contains this code: SET PROCEDURE TO Main.prg ON KEY LABEL F12 CLEAR EVENTS ON KEY LABEL F11 SET SYSMENU TO DEFAULT

DO MyMenu.MPR READ EVENTS

SET SYSMENU TO DEFAULT

PROCEDURE ClearForms                 && Clear all open forms IF _SCREEN.FormCount > 0 FOR i = _SCREEN.FormCount TO 1 STEP -1 _SCREEN.Forms(i).Release ENDFOR ENDIF  Create a menu named MyMenu.   Add a Form1 prompt that uses this command: DO FORM Form1.SCX   Add a Clear Forms prompt that uses this command: DO ClearForms   Add an Exit program prompt that uses this command: CLEAR EVENTS  Generate and save the menu in the directory where Main.prg is located.</li></ol> </li> Create a form named Form1. <ol style="list-style-type: lower-alpha;"> Add the Customer and Orders tables located in the Vfp\Samples\Data directory to the data environment.</li> Drag a field from the Customer table onto the form to create a text box.</li> Drag the Orders table onto the form to create a grid.</li> Save the form in the directory where Main.prg is located.</li></ol> </li> Open the Debug window and place _screen.formcount in the left pane.</li> Run Main.prg.</li> Click the Form1 menu, and then click the grid to give it the focus. _screen.formcount will equal 1. Multiple instances of Form1 can be run with the same result.</li> Release Form1 by clicking the Clear Forms menu. Form1 will clear off the screen, but _screen.formcount will still equal 1.</li> Exit the program, or click the Clear Forms menu again to return _screen.formcount to 0.</li></ol>

Keywords: kbbug kbfix kbvfp500fix KB138563

-

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

© Microsoft Corporation. All rights reserved.