How can I use a procedure in delphi?(50分)

  • 主题发起人 主题发起人 linyuan
  • 开始时间 开始时间
L

linyuan

Unregistered / Unconfirmed
GUEST, unregistred user!
for example, I have created a procedure in delphi
and I want use a button to call it.
How can I compelte this?
becasue I can't put the whole procedure in the button onclick
event between "begin
and end"
"gelugaoshou", kindly show me.
 
在onclick中调用不就得了?
 
1.first, define your procedure :
procedure <font color=red>abc</font>;
begin
//do something ....
end;

2.then
, put this code into the OnClick event:
procedure tform1.button1Click(sender:tobject);
begin
<font color=red>abc</font>;
end;
 
简单,如要创建a过程下:
type
procedure a();//在type中添加声明
.......
implementation
{$R *.DFM}
procedure form1.a();
begin
.....
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
a;//调用过程a
..........
end;
 
还可以:
procedure TForm1.Button1Click(Sender: TObject);
procedure a();
begin
.....
end;
begin
a;//调用过程a
..........
end;
 
多人接受答案了。
 
后退
顶部