Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form did not release

Status
Not open for further replies.

viettla

Programmer
Jul 19, 2002
34
VN
I have a form with treeview and grid on it. It’s name “Detail_form”. When Detail_form is activating and grid has focus I select a Item from menu. That item calls a “ShowSalDecForm()” procedure .
*********************************
Procedure ShowSalDecForm()
CloseAllForms()
Do form forms\saldec
*Saldec form is modal form
Endpro
*********************************
Procedure CloseAllForms
Local loForm
FOR EACH loForm IN application.Forms
IF TYPE("loForm") == "O" AND loForm.Baseclass == "Form"
IF !loForm.QueryUnload()
RETURN .F.
ENDIF
loForm.Release()
ENDIF
ENDFOR
Endpro
************************
My problem that Detail form can not release before “Saldec form” shows. when Detail_form’s gird has focus. “Saldec” form display but “detail_form” stay behid “Saldec” form. If I put code of ShowSalDecForm() procedure into click method of a button in toolbar that problem doesn’t happen
I think it’s internal error of VFP but I can not solve it. Anyone has idea ? I’m using VFP60, SP5
Thank you very much.


Viet
 
Because you're calling the Saldec form from the Detail form, there is still an open reference to the Detail form's object. Just as if you had called a .prg from a parent .prg.
Try using loForm.Hide in your loop instead of loForm.QueryUnload() so the form doesn't display, (or you can use Detail.Hide). Then Detail.Show when you want to see it again, for instance in the Saldec.Release method.


-Dave S.-
[cheers]
Even more Fox stuff at:
 
Dave,
Thank for your reply
You may misunderstand my mean because my English is not very well
I did not call Saldec form from Detail form. I call SalDec form from a item menu. That item menu calls “ShowSalDecForm” procedure. “ShowSalDecForm” procedure will close all forms which are displaying finally, it shows Saldec form. If Detail form’s treeview has focus, I can run ShowSalDecForm procedure without any problem. Detail form will be closed before Saldec form shows. But Detail form will not be closed if Detail form’s grid has focus. Detail form still display behind Seldec form. I really want to close all forms before SalDec form shows because there is a conflict between data of those forms.


Viet
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top