Reputation: 2593
I have created a new unit like so and it should be a custom TShape.
unit MachineShape;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, extctrls,myDataModule,Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TMachine = class(TShape)
count : Integer;
private
{ Private declarations }
public
{ Public declarations }
procedure PlaceShape(sizeW,sizeH :integer; name, order,asset : string);
end;
implementation
Procedure PlaceShape(sizeW,sizeH :integer; name, order,asset : string);
begin
end;
end.
next i pass this to the procedure
MachineShape.TMachine.PlaceShape(44,49,'CM402','first','123/33/123');
How do i set in the procedure to set the shape size as 44 width and 49 height?
I have tried to do TMachine.Width but it does not work? thanks glen
Upvotes: 0
Views: 413
Reputation: 613332
You've declared PlaceShape
to be an instance method and so need to implement it as such:
Procedure TMachine.PlaceShape(sizeW,sizeH :integer; name, order,asset : string);
begin
Width := sizeW;
Height := sizeH;
....
end;
You declared a function
Procedure PlaceShape(...);
that is not a method of the class.
This question suggests that you are missing some understanding of the Delphi object model. I refer you to the relevant section of the language guide to fill in the missing knowledge.
I would also recommend that you use different names for your dimensions parameters. You should use AWidth
and AHeight
so that it is clear to future readers of the code that these parameters are going to be used to set the corresponding shape properties.
Upvotes: 2