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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Event called on closing a form...

Status
Not open for further replies.

Neil Toulouse

Programmer
Mar 18, 2002
882
GB
Hi!

Forgive me if I have already asked this, but could someone tell me waht event/method is fired first when the user clicks on the 'X' to close a form?

TIA

Neil

I like work. It fascinates me. I can sit and look at it for hours...
 
1. form1.QueryUnload()
2. form1.Destroy()
3. form1.Unload()


But if you issue somewhere in the form thisfrom.Release() QueryUnload() not fired, so you must changed this to:
Code:
IF thisform.QueryUnload()
   thisform.Release()
ENDIF

Borislav Borissov
 

1. form1.QueryUnload()
2. form1.Destroy()
3. form1.Unload()

I'd add the following:

1. LostFocus of control that currently has focus.

2. Deactivate of the form.

3. QueryUnload (form).

4. Destroy (form).

5. Destroy of each control on the form.

6. Unload (form).

Not sure of the exact order of the first three, but I think the rest are right.

By the way, the same events fire if you close the form by any other interactive means, such as Close from the system menu or the taskbar, or closing Windows.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Mike & Borislav

Many thanks for the replies, most helpful!

Neil

I like work. It fascinates me. I can sit and look at it for hours...
 
Hi Neil,

You can always use EVENTTRACKING or COVERAGE to get answers on such questions about the order in which events fire. The evntlist can easily be set to the complete list of all events with a dialog box of the debugger. Choose Debugger from the tools menu of VFP and then choose Event tracking from the tools menu of the debugger. Also see the help on SET EVENTTRACKING, SET EVENTLIST and SET COVERAGE.

Bye, Olaf.
 
thanks guys!

I like work. It fascinates me. I can sit and look at it for hours...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top