Did you forget to include right

[pascal]
function PointInRect(Pt : TPoint; R : TRect) : Boolean;
begin
result := (Pt.X>=R.Left) and(Pt.X<=R.right) and (Pt.X<R>=R.Top) and (Pt.Y<=R.Bottom)
end; [/pascal]