Pier Posted March 23, 2020 Share Posted March 23, 2020 Can MessageDlg be modified in such a way that the Callback function is not procedure EditCallback(Sender: TComponent; res :Integer); but procedure EditCallback(Sender: TComponent; DataSet: TDataSet;res :Integer); in other words I would like to pass some other stuff to the callback Quote Link to comment Share on other sites More sharing options...
Pier Posted February 19, 2021 Author Share Posted February 19, 2021 No ideas anyone? Quote Link to comment Share on other sites More sharing options...
x11 Posted February 21, 2021 Share Posted February 21, 2021 procedure TfmmClientsDataEdit.TreeTriggerCallbackAnonProc(Sender: TComponent; Res: Integer); Var fmmSelFromTree: TfmmSelFromTree; ds: TDataSet; begin if Res <> mrOk then exit; if Sender is TfmmSelFromTree then fmmSelFromTree := Sender as TfmmSelFromTree else exit; ds := fmmSelFromTree.MyDataSet1; end; Quote Link to comment Share on other sites More sharing options...
Pier Posted February 23, 2021 Author Share Posted February 23, 2021 Thanks for the help but this is not what is needed in my case. I want a single function to handle all datasets not just one (like MyDataSet1 in your example). The problem is that the Sender is the MainForm and not the DataSet which called the MessageDlg which then invoked the callback... Quote Link to comment Share on other sites More sharing options...
Pier Posted February 24, 2021 Author Share Posted February 24, 2021 in the end I solved the problem with an anonymous callback procedure and thanks to closures I used the DataSet available in the BeforeDelete and BeforePost events (hope it doesn't leak, I will check) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.