I have a method called Rotate and I am calling it from another method as follows:
Rotate method as defined:
method TMakerGraphic.Rotate(var pts:array of Point; pcnt,xc,yc:integer);
Calling it from another method as follows:
method TMakerLine.GetDynamicBounds(var r:Rectangle);
var
pts:array[1..2] of Point;
midx,midy:integer;
begin
with bounds do
begin
pts[1].x := left;
pts[1].y := top;
pts[2].x := right;
pts[2].y := bottom;
if Active then
begin
r := bounds;
with r do
begin
midx := ((right - left) div 2) + left;
midy := ((bottom - top) div 2) + top;
end;
Rotate(var pts,2,midx,midy); <<<<============= Here is where it raises the error
end;
end;
end;
It raises an error, "There is no overloaded method 'Rotate' with these parameters." I checked to make sure the parameters and method calls were correct and I think they are, but it is raising this error. I don't understand why.
Thanks in advance,
This error is because the array of Point
type is a Unbound array and the array[1..2] of Point
is a Bound array, so you are passing different types, to fix the issue declare the pts
variable as a array of Point
and then using New
you can set the size of the array.
Check this sample
var
pts:array of Point;
midx,midy:integer;
begin
with bounds do
begin
pts:= New Point[2];
pts[0].x := left;
pts[0].y := top;
pts[1].x := right;
pts[1].y := bottom;