unit_form The main form becomes,
unit unit_form;
{$mode delphi}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
ExtCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Panel1: TPanel;
Panel2: TPanel;
procedure FormCreate(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
uses
unit_frame00,
unit_frame01;
procedure TForm1.FormCreate(Sender: TObject);
begin
FrameAA := TFrame00.Create(nil);
FrameAA.Parent := Panel1;
FrameBB := TFrame01.Create(nil);
FrameBB.Parent := Panel2;
end;
initialization
{$I unit_form.lrs}
end.
I am no longer declaring FrameAA and FrameBB as variable within this unit but the uses clause gives it access to declarations of them in unit_frame00 and unit-frame01.
I'm sorry but it is difficult, as a novice, to understand the order of declaration of things and where those declarations are made to achieve the right results without being moaned at... I might actually be getting there. On the other hand I might be breaking all the house rules.
unit_frame00
unit unit_frame00;
{$mode delphi}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, StdCtrls;
type
{ TFrame00 }
TFrame00 = class(TFrame)
Edit01: TEdit;
Edit02: TEdit;
Edit03: TEdit;
procedure EditChange(Sender: TObject);
procedure EditUpdate(Edit1,Edit2,Edit3: String);
private
{ private declarations }
MyObj: TObject;
public
{ public declarations }
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
end;
var
FrameAA: TFrame00;//Declared here to expose it externally
implementation
uses
unit_frame01;//To give it access to FrameBB
procedure TFrame00.EditChange(Sender: TObject);
begin
With FrameAA do FrameBB.EditUpdate(Edit01.Text,Edit02.Text,Edit03.Text);
{References FrameBB exposed in the uses clause and saves having to write FrameAA.Edit01.Text etc}
end;
procedure TFrame00.EditUpdate(Edit1,Edit2,Edit3: String);
begin
Edit01.Text := Edit1;
Edit02.Text := Edit2;
Edit03.Text := Edit3;
end;
constructor TFrame00.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
MyObj := TObject.Create;
end;
destructor TFrame00.Destroy;
begin
MyObj.Free;
inherited Destroy;
end;
initialization
{$I unit_frame00.lrs}
end.
unit_frame01
unit unit_frame01;
{$mode delphi}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, StdCtrls;
type
{ TFrame01 }
TFrame01 = class(TFrame)
Edit01: TEdit;
Edit02: TEdit;
Edit03: TEdit;
procedure EditChange(Sender: TObject);
procedure EditUpdate(Edit1,Edit2,Edit3: String);
private
{ private declarations }
MyObj: TObject;
public
{ public declarations }
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
end;
var
FrameBB: TFrame01;//Declared here to expose it externally
implementation
uses
unit_frame00;//To give it access to FrameAA
procedure TFrame01.EditChange(Sender: TObject);
begin
With FrameBB do FrameAA.EditUpdate(Edit01.Text,Edit02.Text,Edit03.Text);
{References FrameAA exposed in the uses clause and saves having to write FrameBB.Edit01.Text etc}
end;
procedure TFrame01.EditUpdate(Edit1,Edit2,Edit3: String);
begin
Edit01.Text := Edit1;
Edit02.Text := Edit2;
Edit03.Text := Edit3;
end;
constructor TFrame01.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
MyObj := TObject.Create;
end;
destructor TFrame01.Destroy;
begin
MyObj.Free;
inherited Destroy;
end;
initialization
{$I unit_frame01.lrs}
end.
and now things compile and run and the frames are 'talking to each other'. I might be certain that there would be a 'better' way but it works.
Once again, Thank You for providing the assistance. I shall now have to glue the hair I tore out yesterday back on.
Assuming I am right.. Do I mark this as 'Solved'?