我是创建了一个tspeedbutton数组;
var
spb:array[5] of tspeedbutton;
begin
for i:=1 to 5 do
begin
spb:= tspeed.Create(self);
spb.parent:= self;
spb.Left:= xx;
spb.Top:= xx;
end;然后要创建它们的onclick事件
procedure spb[i]click(send:tobject);
begin
.....
end;就是这一部分实现不了。
我想做到按一下新做的控件,就触发它的onclick时间。实现showmessage;
或有什么方法,实现这些新按钮的onclick事件。请赐教!
var
spb:array[5] of tspeedbutton;
begin
for i:=1 to 5 do
begin
spb:= tspeed.Create(self);
spb.parent:= self;
spb.Left:= xx;
spb.Top:= xx;
end;然后要创建它们的onclick事件
procedure spb[i]click(send:tobject);
begin
.....
end;就是这一部分实现不了。
我想做到按一下新做的控件,就触发它的onclick时间。实现showmessage;
或有什么方法,实现这些新按钮的onclick事件。请赐教!
解决方案 »
- 如何统计字符串占用字节数的问题????紧急求救?
- 一个困扰我的数据连接问题
- [菜鸟请教]在输入时间的时候一个奇怪的问题
- 提一个ADO 连接的问题
- delphi的两个小问题
- 用ADODATASET。SAVETOFILE后,将文件取出通过网络发送,另一端接收后用ADODATASET.LOADFROMFILE 载入时报错,无效字符,文件中有中文,如何解决
- 现在想学习delphi代码 听说是pasical语言编写的 要想熟练delphi代码就必须先熟悉pasical这项语言不知道是不是
- 我现在的公司
- 怎样控制?
- 如何编程实现在“控制面板”里添加图标?
- 我用API函数建立的窗体,请问如何使用Delphi中的控件及它的事件(比如Timer)?
- 在指定的位置创建WORD文档?
spb:array[5] of tspeedbutton;
begin
for i:=1 to 5 do
begin
spb[i]:= tspeed.Create(self);
spb[i].name = 'spb'+IntToStr(i);
spb[i].parent:= self;
spb[i].Left:= xx;
spb[i].Top:= xx;
spb[i].onclick = spbClick;
end;procedure spbClick(send:tobject);
begin
What you want to do for spb array
end;
procedure spbClick(sender:tobject);
begin
with TSpeedButton(FindComponect('spb'+InteToStr(m))) do
begin
......
end;
end;note:m=1到5。
也就是onclick事件。如:
procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
showmessage('你好');end;但我自己建的控件
spb:= tspeed.Create(self);
spb.parent:= self;
spb.Left:= xx;
spb.Top:= xx;
怎么样在.pas单元文件中实现这个procedure???按下自己建的新控件,所触发的过程就实现得了。
我试用过写
procedure spbClick(sender:tobject);
begin
showmessage('你好');
end;
生成的窗体,按下spb的时候,什么也没发现,
!!!!!!!!!!!