>Hello:
>
>This is probably stupid, but I have to ask.
>
>Usually I set the Closable property of my forms to .F. so I don't allow my users to click in the close button of the form and insted I place a Save and a Cancel button to process whatever the user wants to do , but then I thought, Why not make the form more friendly? I just have to execute a few validations if the user clicks on the close button and that's it, but here's what I noticed.
>
>My form uses table buffering, so nothing is supposed to be updated in the table unless I issue TableUpdate() right?, but if I click the close button in the form (The tiny X in the upper right corner), all changes take place even if I don't issue TableUpdate().
>
>Is this a normal behavior, or is there a property that I can set to change this?
>
>This is really not that important but I would like to know. I want my form to function like when you are using the Form designer for example, If you change anything and click on the close button, a Dialog asks if you want to Save the Changes you made, but if you didn't, nothing happens and the Form designer closes.
>
>Just so that you know I am issuing:
>
>("2" $ GETFLDSTATE(-1, cMyTable) OR "4" $ GETFLDSTATE(-1, cMyTable))
>
>to find out if the record changed, but if this condition returns .F. the data is saved to my buffered table anyways.
>
>TIA
>
>Mao.
If I remember correctly, you have to intercept event Form.QueryUnload().
This will be invoked whether you close your form from a button (Button.Click() = ThisForm.Release()), or from the "x", or with Ctrl-F4.
If you decide you can't close the form (e.g., user is asked about pending changes, and answers pressing the "Cancel" button), put NODEFAULT into this method.
HTH, Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)