The same property and procedure in different Classes. How they can be accessed ?
Posted
by lyborko
on Stack Overflow
See other posts from Stack Overflow
or by lyborko
Published on 2010-04-21T06:47:32Z
Indexed on
2010/04/21
6:53 UTC
Read the original article
Hit count: 208
delphi
Hi,
I created several new objects
TMyMemo = class (TMemo)
private
FYahoo = Integer;
procedure SetYahoo(Value:integer)
public
procedure Google(A,B:integer; S:string);
published
property Yahoo:integer read FYahoo write SetYahoo;
end;
TMyPaintbox = class (TPaintbox)
private
FYahoo = Integer;
procedure SetYahoo(Value:integer)
public
procedure Google(A,B:integer; S:string);
published
property Yahoo:integer read FYahoo write SetYahoo;
end;
TMyButton = class (TButton)
private
FYahoo = Integer;
procedure SetYahoo(Value:integer)
public
procedure Google(A,B:integer; S:string);
published
property Yahoo:integer read FYahoo write SetYahoo;
end;
. . .
These Controls are placed on Form1. Is there a way, how can I change the same property (Yahoo) and run the procedure (Google), which is declared in different objects (inheritance is not possible) ?
procedure Form1.Button1Click(Sender:TObject);
var i:integer;
begin
for i:=0 to Form1.ControlCount-1 do
begin
Controls[i].Google(4,5, 'Web'); // this should be changed somehow
Controls[i].Yahoo:=6; // this should be changed somehow
end;
end;
end;
Thanks
© Stack Overflow or respective owner