mierlp Posted January 24, 2013 Share Posted January 24, 2013 Hi I have a form including a dbnavigator for editing product. When the user closes the form the OnClose events is fired with the following code. There's a check if the database is in edit or insert mode and if...then fire the message for saving or canceling the changes. procedure TFormProduct.UniFormClose(Sender: TObject; var Action: TCloseAction); begin if dmMain.Product.State in [dsEdit,dsInsert] then begin MessageDlg('Information has been changed but not saved' + '<br/><br/>' + 'Would you like to save the changes (Y/N) ?', mtConfirmation, mbYesNo, QuestionSaveYesNo); end; end; This uses the following Callback code : procedure TFormProduct.QuestionSaveYesNo(Res: Integer); begin case Res of mrYes : dmMain.Product.Post; mrNo : dmMain.Product.CancelUpdates; end; end; This should do the trick (normally in vlc it does) but for some reason it doesn't cancel the changes and the changes are always saved. A other behavior is that the form is already close and only the question is on the screen, normally both have to be on screen...maybe it's a behavior of EXT JS ? How to modify it so that the form is still on screen including the message (is Onclose the wrong event?) and the changes are canceld. I still use 0.89 because of the uniEdit desing height issue...which i don'nt know if it's already solved? Regards Peter Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.