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

closable button

Status
Not open for further replies.

Rottdpogs

IS-IT--Management
Jul 17, 2001
86
CN
How can i know when the user clicked the closable button.
I would like to put a messagebox whenever the user click the close button in the form.
Thanks in advance. Please advice.
 
Rottdpogs

This button, what would it close? A form or the whole application?

Putting a:
messagebox("Are you sure you want to close this?",36)

In the click event of the button, but I presume you need more then this. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
If you're referring to the little box in the upper right-hand corner with an 'X' in it, or the 'Close' selection from the menu, modify Mike's code something like this, and put it in the QueryUnload event of the form:

IF messagebox("Are you sure you want to close this?",36) == 6 &&... Yes selected
Thisform.Release
ENDIF
NODEFAULT
Dave S.
[cheers]
 

In your form's DESTROY event:

IF THISFORM.ReleaseType = 1
=Messagebox( "Close (X) Button was pressed." )
ENDIF

Al
 
Rottdpogs,
perhaps it could be more simple to disable the close botton (closable=.f.) and use a classic "thisform.release" button, so you would be able to better manage the events.
Mmhhh.... I suppose that you already know this, but you can't choice this solution.

Casters
 
Should you wish to allow users to confirm closing form (after they hit the close (X) button), place this code in the form's QUERYUNLOAD event:

IF THISFORM.RELEASETYPE = 1
IF MESSAGEBOX( "EXIT for sure?",36,"" ) = 7
NODEFAULT
ENDIF
ENDIF

Al
 
thanks everyone. it works i put my codes in query unload
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top