Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Form does not release from menu
Message
From
11/06/2004 14:51:59
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Form does not release from menu
Miscellaneous
Thread ID:
00912852
Message ID:
00912852
Views:
50
I am unable to release forms programatically from the menu when there is a grid on the form and one of the cells on the grid has focus.

It works fine when a textbox or combobox or checkbox has the focus, and works fine if the procedure is called from the command window. However when the procedure is called from the menu and a cell on the grid has focus, the form will not release until the procedure RETURNs.

The stripped down procedure called from the menu or executed from the command window is:
PROCEDURE OPEN_INCIDENT
LOCAL i as Integer, lFormsShut as Boolean

lFormsShut = .T.

FOR i = _Screen.FormCount TO 1 STEP -1
   * backwards because the form count will be changing
   IF UPPER(_Screen.Forms[i].BaseClass) == 'FORM'
      IF _Screen.Forms[i].QueryUnload()
         _Screen.Forms[i].Release(.T.)	&& do not confirm release
      ELSE
         lFormsShut = .F.
      ENDIF
   ENDIF
ENDFOR

...
Under the conditions that it works the forms release on the line _Screen.Forms[i].Release(.T.). Under the conditions that it does not work the forms will not release until the procedure executes the RETURN at the end. Unfortunately there is a lot of code between where the form should release and the RETURN that expects the forms to all be closed.

The menu is created with the Menu Designer, this is in VFP 8 SP 1 on a Windows XP Professional machine with all the lastest service packs.

Any suggestion appreciated since I have just about torn out all my hair over this one.

Thanks in advance,
David
Next
Reply
Map
View

Click here to load this message in the networking platform