代码之家  ›  专栏  ›  技术社区  ›  Alin Sfetcu

Delphi XE IDE代码解析器错误?

  •  4
  • Alin Sfetcu  · 技术社区  · 15 年前

    在添加 IdUDPServer 到我的表格中,并试图在 OnUDPRead 事件时,我无法在设计时向窗体添加任何组件,也无法运行应用程序。

    this is the error i'm getting

    有什么办法解决这个问题吗?

    1 回复  |  直到 6 年前
        1
  •  1
  •   mjn anonym    15 年前

    此事件处理程序有两个错误。要修复它们,你可以

    • 卸下系统。从…起 TArray<System.Byte> (在接口和实现中)
    • 添加 IdSocketHandle 转到界面中的“使用”列表

    我没有进一步调查,但在这些更改之后,代码就可以编译了。

    所以完整的代码应该是

    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;