procedure TForm1.Button1Click(Sender: TObject); var buttontemp:tbutton; begin buttontemp:=tbutton.Create(self); buttontemp.Parent:=panel1; buttontemp.Caption:='确定'; end;
楼上的前辈:. . . procedure TForm1.Button1Click(Sender: TObject); var a:tform; var b:tbutton; begin a:=tform.Create(application); a.Left:=100; a.Top:=100; a.Visible:=true; b:=tbutton.Create(a); b.ParentWindow:=a.Handle; b.Left:=10; b.Top:=10; b.Name:='button1'; b.Caption:='button1'; b.OnClick:=ABCD; b.Visible:=true; end; ..... procedure TFORM1.abcd(sender:TOBJECT); BEGIN <*>这里我该怎么写呢?<*> END;
TO: zhouxiaochenchina() 我不是你这个意思哦
procedure TForm1.Button1Click(Sender: TObject); var a:tform; var b:tbutton; var c:tedit; begin a:=tform.Create(application); a.Left:=100; a.Top:=100; a.Visible:=true; b:=tbutton.Create(a); b.ParentWindow:=a.Handle; b.Left:=10; b.Top:=10; b.Name:='button1'; b.Caption:='button1'; b.OnClick:=ABCD; b.Visible:=true;c:=tedit.Create(a); c.ParentWindow:=a.Handle; c.Left:=b.Left+b.Width +5; c.Top:=10; c.Name:='tedit1'; c.Text:='tedit1'; c.Visible:=true; end; ..... procedure TFORM1.abcd(sender:TOBJECT); BEGIN <*>要改变C 的 TEXT 这里我该怎么写呢?<*> END;
TO:welllove88(寒林) A是动态创建的
var DControlList:TList;//你的动态控件指针列表,这样就不会出现LEAK了 procedure xxxx; var b:Button; begin b:=Button.Create(Form1); DControlList.Add(B); //do some end;procedure xxx*****; var i:Integer; begin I:=DControlList.Indexof(B); TButton(DControlList[i]).Dosome//你要做的事情. end; //上面的代码只是例子你可以参考
procedure TFORM1.abcd(sender:TOBJECT); BEGIN <*>要改变C 的 TEXT 这里我该怎么写呢?<*> if sender is Tedit then //不知道是不是你要的结果... Tedit(sender).text:=''; END;
TO: shun3(天使鬼差) abcd是由 新创建按钮的 ONCLICK SENDER 不会是 TEDIT 的
procedure TFORM1.abcd(sender:TOBJECT); BEGIN (((sender as TButton).Parent as TForm).FindComponent('tedit1') as TEdit).Text := 'XXXX';<*>这里我该怎么写呢?<*> END;
<--------------------------------------------------------------------->
真的没有人...
你要將寫好一個事件函數,
F2BTN1 Create 後, 將其Click事件指到該函數
var
buttontemp:tbutton;
begin
buttontemp:=tbutton.Create(self);
buttontemp.Parent:=panel1;
buttontemp.Caption:='确定';
end;
.
.
procedure TForm1.Button1Click(Sender: TObject);
var a:tform;
var b:tbutton;
begin
a:=tform.Create(application);
a.Left:=100;
a.Top:=100;
a.Visible:=true;
b:=tbutton.Create(a);
b.ParentWindow:=a.Handle;
b.Left:=10;
b.Top:=10;
b.Name:='button1';
b.Caption:='button1';
b.OnClick:=ABCD;
b.Visible:=true;
end;
.....
procedure TFORM1.abcd(sender:TOBJECT);
BEGIN
<*>这里我该怎么写呢?<*>
END;
var a:tform;
var b:tbutton;
var c:tedit;
begin
a:=tform.Create(application);
a.Left:=100;
a.Top:=100;
a.Visible:=true;
b:=tbutton.Create(a);
b.ParentWindow:=a.Handle;
b.Left:=10;
b.Top:=10;
b.Name:='button1';
b.Caption:='button1';
b.OnClick:=ABCD;
b.Visible:=true;c:=tedit.Create(a);
c.ParentWindow:=a.Handle;
c.Left:=b.Left+b.Width +5;
c.Top:=10;
c.Name:='tedit1';
c.Text:='tedit1';
c.Visible:=true;
end;
.....
procedure TFORM1.abcd(sender:TOBJECT);
BEGIN
<*>要改变C 的 TEXT 这里我该怎么写呢?<*>
END;
DControlList:TList;//你的动态控件指针列表,这样就不会出现LEAK了
procedure xxxx;
var
b:Button;
begin
b:=Button.Create(Form1);
DControlList.Add(B);
//do some
end;procedure xxx*****;
var
i:Integer;
begin
I:=DControlList.Indexof(B);
TButton(DControlList[i]).Dosome//你要做的事情.
end;
//上面的代码只是例子你可以参考
2>然后你创建完新的button1后,补一句代码 button1.onclick:=button.onclick
这样就可以了
procedure TFORM1.abcd(sender:TOBJECT);
BEGIN
<*>要改变C 的 TEXT 这里我该怎么写呢?<*>
if sender is Tedit then //不知道是不是你要的结果...
Tedit(sender).text:='';
END;
abcd是由 新创建按钮的 ONCLICK
SENDER 不会是 TEDIT 的
BEGIN (((sender as TButton).Parent as TForm).FindComponent('tedit1') as TEdit).Text := 'XXXX';<*>这里我该怎么写呢?<*>
END;
ttch(最近比较烦(工作没找到))
结贴了!!