Hi All
I wish to add a TShape using a class called from the MainUnit (Containing the main form and the TPanel I wish to add the Tshape to). I can do this but for some reason the TShape is not shown on the main form? I wish the TShape to be
Here is my Class constructor
constructor tNPCObjectType.Create(sObjNameIn: string; xPos, yPos, iWidth, iHeight: integer; tType: tObj_Type; iDistance: integer; iMoveSpeed: integer; tCompToAdd: TPanel);
begin
tNPC_Shape:=TShape.Create(tCompToAdd);
tNPC_Shape.Shape:=TShapeType.stRectangle;
tNPC_Shape.Left:=xPos;
tNPC_Shape.Top:=yPos;
case tType of
tObj_Type.tStill:
begin
tNPC_Shape.SetBounds(xPos, yPos+24, 24, 24);
end;
tObj_Type.tHorizontal:
begin
//tNPC_Shape.SetBounds(xPos, yPos+24, 24, iDistance);
//DEBUG
tNPC_Shape.SetBounds(24,24,100,100);
end;
tObj_Type.tVertical:
begin
tNPC_Shape.SetBounds(xPOs, yPos+24, iDistance, 24);
end;
end;
tNPC_Shape.Pen.Color:=clBlue;
tNPC_Shape.Brush.Color:=clWhite;
tNPC_Shape.Brush.Style:=bsSolid;
tNPC_Shape.Visible:=true;
bInit:=true;
end;
Here is the Calling Code:
aNPC:=tNPCObjectType.Create(anObjName,npcShape.Left, npcShape.Top, 24, 24, npc_Type, iDist, 4, ScenePanel);
Any ideas why the newly created TShape in the class is not being displayed?