I use Delphi XE3. I have two form, TParentForm and TChildForm. TParentForm contains Button1, and TChildForm is inherited from it.
Then when I operate Button1 in TParentForm, in the following procedure TParentFrm.Button2Click(Sender: TObject), is it operating on the instance of Button1 in ChildForm when I invoke ChildForm.Show and click Button1?
type
TParentFrm = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
TChildForm = class(TParentFrm)
private
{ Private declarations }
public
{ Public declarations }
end;
var
ParentFrm: TParentFrm;
implementation
{$R *.dfm}
procedure TParentFrm.Button2Click(Sender: TObject);
begin
Button1.Caption := '&Test'; // Is it operating on Childform's button1 when I
// create and show child form and then click
//"Button2".
end;
Test unit:
procedure TForm1.Button1Click(Sender: TObject);
begin
ChildForm.Show;
end;
TParentForm
andTChildForm
? I'm pretty sure that this understanding is key for you. - David Heffernan