我有36个TSpeedButton按纽,它们的Caption分别为'0'..'9'和'A'..'Z'数值和字母,
当我点击其中的一个speedbutton时,要把它的Caption赋值给一个Edit,应该怎么写事件赋值?
当我点击其中的一个speedbutton时,要把它的Caption赋值给一个Edit,应该怎么写事件赋值?
解决方案 »
- 一个具备很高性价比的帖子:这样的功能好不好实现,只需要大家提供方法.
- 用什么空间显示如下结构的结果????????
- SQL语句怎么写呀
- 请问在那里可以下载DELPHI补丁?
- 有没有宁波的朋友? 欢迎进来聊聊。
- 如何对checkbox和RadioGroup1进行判断?
- 谁知道哪里有WindowMediaPlayer组件编程的例程?
- 怎样在delphi中用Table控件给dbf库文件加一个字段?最好有代码!
- 如何让表格多列锁定?最好能实现多表头的。有这样的控件吗?如何使用?
- D版DELPHI6 企业版与BORLAND网站上下载的Delphi Person 版哪个学习编程用更好
- 如何定义某一列为文本
- 100分 简单的赋值问题
在里面写如下代码:
procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
Edit1.Text := (Sender as TSpeedButton).Caption;
end;
if (component[i] is tspeedbutton) then
edit:= tspeedbutton(component[i]).caption;
i:integer;
begin
with Form do
for i := 0 to ComponentCount-1 do
if (Components[i] is TSpeedButton) then
(Components[i] as TSpeedButton).OnClick:=DoButtonClick
end;procedure TForm1.DoButtonClick(Sender: TObject);
begin
Edit.Text:=(Sender as TSpeedButton).Caption;
end;
循环到哪个被Click,i就是几