Hi

While reading a bug report I made the following experiment with Delphi 2009
and then with Lazarus + FPC 2.4.4.

TMainMenu.Items is of type TMenuItem. TMenuItem has only one version of
"Add" method and it takes another TMenuItem as parameter (checked from VCL
source).
Still, to my surprise, the code works in Delphi.

FPC says: Error: Incompatible type for arg no. 1: Got "Dynamic Array Of
TMenuItem", expected "TMenuItem"
which is what I expected also from Delphi.

---
procedure TForm1.FormCreate(Sender: TObject);
var
  ma: array of TMenuItem;
  mi: TMenuItem;
begin
  SetLength(ma, 2);

  mi := TMenuItem.Create(MainMenu1);
  mi.Caption := 'File';
  ma[0] := mi;

  mi := TMenuItem.Create(MainMenu1);
  mi.Caption := 'Help';
  ma[1] := mi;

  MainMenu1.Items.add(ma); // Works in Delphi
end;
---

Is this a known issue?

Regards
Juha
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to