dialog window cancel function

how can i run a function if you close a dialog window with out clicking “ok”

anyone know?

You’ll have to be more specific.

what bit was i vague about ?
there is a dialog window
it can be closed by pressing ok or clicking outside of it or by pressing escape
how do i tell a function to be run if it is closed by not pressing ok?

so i take it this is just one of them supper advanced things that only the guy who coded blender knows about?