Jump to content

Callback of MessageDlg in TUniFrame


yoshimi sakata

Recommended Posts

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

Link to comment
Share on other sites

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;

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...