Jump to content
Sign in to follow this  
Linuxuser1234

Using a component from one unit to other units

Recommended Posts

I have a unit called BOLT and i would like to use the viewport component from that unit to my GISEngine unit how can i do this?

unit GISEngine;
interface
uses
System.SysUtils,
System.Classes,
BOLT,
FMX.Viewport3D;
implementation
procedure TForm1.Viewport3D1(Sender: TObject);
begin

end;
end.

Error GISEngine does not contain a member named Viewport3D1

Edited by Linuxuser1234

Share this post


Link to post

GISEngine doest not have "TFORM1" class/instance object, then, you can not reference it like this!

 

you can create a generic "procedure ... of object" and use it for two, or, for example:

 

------ form1

  TForm1 = class(TForm)
    Viewport3D1: TViewport3D;
    procedure Viewport3D1Click(Sender: TObject);

 

--------- form2

type
  TForm2 = class(TForm)
    Viewport3D1: TViewport3D;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.fmx}

uses
  Unit1;

 

procedure TForm2.FormCreate(Sender: TObject);
begin
  Viewport3D1.OnClick := Form1.Viewport3D1Click;
end;
 

Edited by programmerdelphi2k

Share this post


Link to post

@programmerdelphi2k i keep getting Type BOLT (which is my unit1 or TForm1) is not yet completely defined  and i have been unable to resolve the error and yes i have looked at the docwiki 

unit GISEngine;
//This unit Displays Shapefiles onto a 3D Globe
interface
uses
System.SysUtils,
System.Classes,
BOLT,
FMX.Viewport3D;
type
BOLT = class(BOLT)
Viewport3D1:TViewport3D;
procedure VP3DGISEngine(Sender: TObject);
private
public
end;
var
Form1 : TForm1;
implementation

end.

 

Edited by Linuxuser1234

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×