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
You’ve declared
PlaceShapeto be an instance method and so need to implement it as such:You declared a function
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
AWidthandAHeightso that it is clear to future readers of the code that these parameters are going to be used to set the corresponding shape properties.