Alin Sfetcu
Alin Sfetcu

Reputation: 542

Delphi XE IDE code parser error: "Expected '>' but '.' found."

After adding a IdUDPServer to my form and trying to put some code into the OnUDPRead event, I'm not able to add any component to my form at design time, nor can I run the application.

this is the error i'm getting

is there any way to solve this ?

Upvotes: 4

Views: 1208

Answers (1)

mjn
mjn

Reputation: 36634

There are two bugs with this event handler. To fix them, you can

  • remove the System. from TArray<System.Byte> (in the interface and implementation)
  • add IdSocketHandleto the uses list in the interface

I have not investigated further but after these changes the code can be compiled.

So the full code would like be

unit Unit12;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, 
  IdSocketHandle, // <-- added
  IdBaseComponent, IdComponent, IdUDPBase, IdUDPClient, IdUDPServer;

type
  TForm12 = class(TForm)
    IdUDPClient1: TIdUDPClient;
    IdUDPServer1: TIdUDPServer;
    procedure IdUDPServer1UDPRead(AThread: TIdUDPListenerThread;
      AData: TArray<Byte>; ABinding: TIdSocketHandle);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form12: TForm12;

implementation

{$R *.dfm}

procedure TForm12.IdUDPServer1UDPRead(AThread: TIdUDPListenerThread;
  AData: TArray<Byte>; ABinding: TIdSocketHandle);
begin
  //
end;

Upvotes: 1

Related Questions