应用开发框架之——根据数据表中的存储的方法名称来调用方法
功用一:在框架里面根据存储在数据表中的方法名来动态调用执行方法。
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure FormCreate(Sender: TObject);
published
procedure Test(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TForm1 }
procedure TForm1.Test(Sender: TObject);
begin
ShowMessage('hello');
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
@Button1.OnClick := MethodAddress('test')
end;
end.
注:MethodAddress()只能获取published声明的方法地址指针。
本文来自博客园,作者:{咏南中间件},转载请注明原文链接:https://www.cnblogs.com/hnxxcxg/archive/2010/05/02/2940964.html