Topic: One procedure for all Forms
Hello Dmitry,
Please how do I make this procedure work?
I have two forms (Form1 & Form2) and a button each (Button1) on each form.
I want this procedure to work for any form. Thus i want to reference any form and its controls in the procedure.
procedure callComponents(Form: TAForm);
begin
Form.Button1.Caption:='Clicked';
end;
procedure Form1_Button1_OnClick (Sender: String; var Cancel: boolean);
begin
callComponents(Form1);
end;
procedure Form2_Button1_OnClick (Sender: String; var Cancel: boolean);
begin
callComponents(Form2);
end;
Thank you.