yoshimi sakata Posted January 21, 2012 Share Posted January 21, 2012 Hi, How do you use Callback of MessageDlg in TUniFrame? type TUniFrame1 = class(TUniFrame) UniButton1: TUniButton; UniMemo1: TUniMemo; procedure UniButton1Click(Sender: TObject); private public end; implementation {$R *.dfm} procedure TUniFrame1.UniButton1Click(Sender: TObject); begin MessageDlg('TUniFrame.MessageDlg',mtInformation, [mbOk], procedure(Res: Integer) begin UniMemo1.Lines.Add(IntToStr(Res)); end ); end; This source code becomes the compilation error Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted January 21, 2012 Administrators Share Posted January 21, 2012 Workaround: Add UniGUIDialogs to uses list. Quote Link to comment Share on other sites More sharing options...
yoshimi sakata Posted January 21, 2012 Author Share Posted January 21, 2012 Workaround: Add UniGUIDialogs to uses list. Hi, Farshad Thanks, I changed it, but the problem is not settled. interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, uniGUITypes, uniGUIAbstractClasses, uniGUIClasses, uniGUIFrame, uniGUIBaseClasses, UniGUIDialogs, uniButton, uniMemo; Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted January 21, 2012 Administrators Share Posted January 21, 2012 Please paste the error code here. You can try below syntax: UniGUIDialogs.MessageDlg('TUniFrame.MessageDlg',mtInformation, [mbOk], procedure(Res: Integer) begin UniMemo1.Lines.Add(IntToStr(Res)); end ); Quote Link to comment Share on other sites More sharing options...
yoshimi sakata Posted January 21, 2012 Author Share Posted January 21, 2012 Hi, Farshad Please paste the error code here. [DCC error] Unit1.pas(31): E2009 not compatible in a model: A method pointer and normal procedure The problem was settled Thanks Unit all Source code unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, uniGUITypes, uniGUIAbstractClasses, uniGUIClasses, uniGUIFrame, uniGUIBaseClasses, UniGUIDialogs, uniButton, uniMemo; type TUniFrame1 = class(TUniFrame) UniButton1: TUniButton; UniMemo1: TUniMemo; procedure UniButton1Click(Sender: TObject); private public end; implementation {$R *.dfm} procedure TUniFrame1.UniButton1Click(Sender: TObject); begin // MessageDlg('TUniFrame.MessageDlg',mtInformation, [mbOk], UniGUIDialogs.MessageDlg('TUniFrame.MessageDlg',mtInformation, [mbOk], procedure(Res: Integer) begin UniMemo1.Lines.Add(IntToStr(Res)); end ); end; end. 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.