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 in general?
I do not want to manually check class type like: if Controls[i] is TMyMemo then ... if controls[i] is TMyPaintbox then ...
because I do not know how many of my new classes will have property Yahoo and method Google (This is only simple example). Probably I have to use ^ and @ operator or FieldAdress, MethodAddress I do not know what else. Can you help me find general solution?
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