I've checked some ideas during the weekend - nothing helped.
I suppose I've found a bug in VFP - here is the proof:Trying to extract the problem I reduced all cases to a simpliest form.
But instead of typing the code here I will reference to TASTRADE.
There is an app object named
tastrade. A code from the
tastrade.cleanup method:
FOR EACH loForm IN application.Forms
IF TYPE("loForm") == "O" AND loForm.Baseclass == "Form"
IF !loForm.QueryUnload()
RETURN .F.
ENDIF
loForm.Release()
ENDIF
ENDFOR
Everything is OK, isn't it?
But - let's make a little experiment.
Try to launch the tastrade app under debugger with a breakpoint set in
cleanup. Open some windows (Customers, Orders etc.) and click on their grids (second pages in pageframe). Now select 'Return to VFP' option from menu. Your debugger should stop at the
cleanup procedure. Step the lines - especially this with
loForm.Release() and watch the screen. You should notice that the first window you opened (Customers f.e.)
hasn't disappeared (!!!). What more - still pressing F8 - after the last line of
cleanup You find yourself in
Customers.Destroy!!!
Interesting, isn't it?
>>>>The problem seems to happen when the focus is set to a control in the grid placed on the form. When the cursor is outside the grid all is OK.
>>
>>>A form will not release if any reference to it is still active.
>>
>>So I'm wondering when such a "blocking" reference can arise? And how it disappears when I click outside the grid?
>>No, it's impossible.
>
>Firstly, one (maybe irrelevant) tip: you should loop _SCREEN.Forms in reversed direction:
>nLoop=_SCREEN.Formcount
>For n=nLoop to 1 Step -1
>...
>
>Check again, do you have any custom form references with Type="O"?
_________________
*|| Andrzej [NJ].