Get the "User pressed close button (in controlbox)" event...

  • Thread starter Thread starter Klaus
  • Start date Start date
K

Klaus

...a seemingly easy task, but I just can't figure it out

want to retrieve the event "close ("X") button clicked" in a modal form. Can't use the "Closing" event as I have to distinguish between a closing of the form after a selection made and an abortion (which happens when the user just closes the modal form by the forms Close ("X") button

Anyone an idea?

Thanks
Klaus
 
Good practice would be to make code that does not need to know this.
Reason: If for some reason the next version of something makes a new way of
closing a window - you would have to change your code accordingly.
You should make the code to flag a success-return whereever this is needed
and you should take anything else as a cancel.

So - your dialog probably will have a static execute method, which creates
the dialog - runs it modal and returns the result - you should set the
result value to cancel in your constructor - and change it whereever you
select to return something else.

If you are in a situation where you have to know - you should override
WndProc and make special code for the message that origines from the X
button.

/Freddy



Klaus said:
..a seemingly easy task, but I just can't figure it out:

want to retrieve the event "close ("X") button clicked" in a modal form.
Can't use the "Closing" event as I have to distinguish between a closing of
the form after a selection made and an abortion (which happens when the user
just closes the modal form by the forms Close ("X") button.
 
Back
Top