Jump to content

Callback of MessageDlg in TUniFrame


yoshimi sakata
 Share

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...