Although setting the Closeable=.F. so that users cannot close the box is nice from a programming standpoint, it's not very nice from a user standpoint. The close box triggers the DESTROY method without RELEASEing the form, so I've had to come up with a flag call ilReleased that is set usually in the RELEASE method and the following code in the DESTROY method that determines whether the form is in the middle of editing or adding...
* If Editing or Adding a record, and closing form, then better ask to save or lose the changes made - if there were any!
IF (This.ilEditRecord OR This.ilAddRecord) AND !This.ilReleased
LOCAL lnAnswer
lnAnswer=MESSAGEBOX("Save any changes made?",MB_YESNO,"Save Changes")
DO CASE
CASE lnAnswer=IDYES
This.UpdateBuffers()
CASE lnAnswer=IDNO
This.RevertBuffers()
ENDCASE
ELSE
This.ilReleased=.T.
This.UpdateBuffers()
ENDIF
So I cover off the chance the user might want to close down fast the way they are used to in WIN95, and check for it already being RELEASED by the normal method, usually a CANCEL Button, or the ESC key.
Of course the ON SHUTDOWN routine still goes through all the DESTROY methods of any active forms on the screen to make sure
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement