Structure of Application
Main Menu
Calls a modeless form (A1) with 12 command buttons and a searchgrid and only way to close is X closebox.
QueryUnload event contains a loop to to release each child form.
Each button can instantiate a modeless form containing searchgrid which sets a property noting this is a child of A1
Problem
With more than 1 child form instantiated, If I select A1 and select closebox, some of the child forms will not release. The contents of QueryUnload follows:
* A1.QueryUnload
local nCount
* Release all "child" forms.
set step on
for nCount = _screen.formcount to 1 step -1
if mvHasProperty(_screen.forms[ncount], "childofcustomerinq")
_screen.forms[ncount].show()
* each child form has a non-visible textbox (design time)
_screen.activeform.txtNotVisible.visible = .t.
_screen.activeform.txtNotVisible.value = ncount
_screen.activeform.txtNotVisible.setfocus()
_screen.Activeform.Release()
endif
next nCount
* A1.QueryUnload end
In the debugger, I've watched this code operate. I can't determine all of the interactions. I've set a watch on _screen.forms[nCount] and can see the name of the form change. When a form releases,
_screen.formcount decrements, but those forms which don't release, the _screen.formcount doesn't decrement. VFP 6.0 is better than 5.0a, but I still can't get anything to work consistently. All forms have at least 1 grid. I found a suggestion on CompuServe that the problem was due to the grid on the form had focus, so the solution was to make certain there was a non-grid object to setfocus on, before trying th release. When the form doesn't release, the destroy event is never triggered.
Any ideas would be greatfully appreciated.
Mike Timpe
Mike