# Error while building delphi package, fmx.castlecontrol.pas

**URL:** https://forum.castle-engine.io/t/error-while-building-delphi-package-fmx-castlecontrol-pas/758
**Category:** Delphi
**Created:** [March 7, 2023, 12:34pm UTC](https://forum.castle-engine.io/t/error-while-building-delphi-package-fmx-castlecontrol-pas/758 "2023-03-07T12:34:55Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![sondertg](https://forum.castle-engine.io/letter_avatar_proxy/v4/letter/s/838e76/32.png) [@sondertg](https://forum.castle-engine.io/u/sondertg)
#### Post date: [March 7, 2023, 12:34pm UTC](https://forum.castle-engine.io/t/error-while-building-delphi-package-fmx-castlecontrol-pas/758/1 "2023-03-07T12:34:55Z")

</div>

I am using Windows 10 and Delphi 10.3 community. I installed CGE on my system. I opened AllPackages.groupproj in the …/packages/delphi directory. When I hit build all, I get below error. I set target as 32 bit Windows.

Error:  
[dcc32 Error] fmx.castlecontrol.pas(359): E2250 There is no overloaded version of ‘FillRect’ that can be called with these arguments

Related routine(line 359, Canvas.FillRect(R, 1.0)):

```delphi
procedure TCastleControl.Paint;
var
  R: TRectF;
begin
  { See our constructor comments:
    looks like native drawing at design-time in FMX is just not possible reliably. }

  if csDesigning in ComponentState then
  begin
    inherited;
    R := LocalRect;

    Canvas.Fill.Kind := TBrushKind.Solid;
    Canvas.Fill.Color := $A0909090;
    Canvas.FillRect(R, 1.0);

    Canvas.Fill.Color := TAlphaColors.Yellow;
    Canvas.FillText(R,
      'Run the project to see actual rendering of ' + Name + ' (' + ClassName + ')',
      true, 1.0, [], TTextAlign.Center);
  end else
  begin
    // inherited not needed, and possibly causes something unnecessary
    FContainer.DoRender;
  end;
end;

```

---

<div class="post-metadata">

### Author: ![michalis](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/michalis/32/3_2.png) [@michalis](https://forum.castle-engine.io/u/michalis)
#### Post date: [March 9, 2023, 7:15am UTC](https://forum.castle-engine.io/t/error-while-building-delphi-package-fmx-castlecontrol-pas/758/2 "2023-03-09T07:15:05Z")

</div>

Thank you for reporting! Embarcadero docs confirm that 10.3 doesn’t have the FillRect we use,

- 10.4: [FMX.Graphics.TCanvas.FillRect - RAD Studio API Documentation](https://docwiki.embarcadero.com/Libraries/Sydney/en/FMX.Graphics.TCanvas.FillRect)
- 10.3: [FMX.Graphics.TCanvas.FillRect - RAD Studio API Documentation](https://docwiki.embarcadero.com/Libraries/Rio/en/FMX.Graphics.TCanvas.FillRect)

As I don’t have 10.3 available for testing now, can you confirm on your side that changing

```delphi
Canvas.FillRect(R, 1.0);

```

→

```auto
Canvas.FillRect(R, 0, 0, [], 1.0);

```

helps? I can commit it to CGE then.

Aside from it, I would advise to upgrade to Delphi 10.4. The latest Community version is 10.4, so it is free, and this is better tested by us 🙂

---

<div class="post-metadata">

### Author: ![sondertg](https://forum.castle-engine.io/letter_avatar_proxy/v4/letter/s/838e76/32.png) [@sondertg](https://forum.castle-engine.io/u/sondertg)
#### Post date: [March 9, 2023, 2:33pm UTC](https://forum.castle-engine.io/t/error-while-building-delphi-package-fmx-castlecontrol-pas/758/3 "2023-03-09T14:33:54Z")

</div>

Yes, it worked. Thanks a lot for the quick response.

---

<div class="post-metadata">

### Author: ![michalis](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/michalis/32/3_2.png) [@michalis](https://forum.castle-engine.io/u/michalis)
#### Post date: [March 9, 2023, 5:17pm UTC](https://forum.castle-engine.io/t/error-while-building-delphi-package-fmx-castlecontrol-pas/758/4 "2023-03-09T17:17:42Z")

</div>

Cool, thanks for confirming. I committed this change then: [Fix Canvas.FillRect call to work with Delphi 10.3 · castle-engine/castle-engine@0344d72 · GitHub](https://github.com/castle-engine/castle-engine/commit/0344d72a9d02a253fa22445155b3734088642015) .
