【发布时间】:2015-11-30 05:32:53
【问题描述】:
这似乎是一个愚蠢的问题,但我已经为此苦苦挣扎了一段时间。我有两个单位。一个是具有声明接口的单元,另一个是我想实现该接口的表单。代码:
unit ITestInterfata;
interface
implementation
type
ITestInterfataUnit = interface
['{A0CD69F8-C919-4D2D-9922-A7A38A6C841C}']
procedure Intrare(s : string);
end;
end.
主窗体单元:
unit frameTestInterfata;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, ITestInterfata;
type
TformaTestInterfata = class(TForm, ITestInterfataUnit)
Button1: TButton;
private
{ Private declarations }
public
{ Public declarations }
procedure Intrare(s: string);
end;
var
formaTestInterfata: TformaTestInterfata;
implementation
{$R *.dfm}
{ TformaTestInterfata }
procedure TformaTestInterfata.Intrare(s: string);
begin
ShowMessage('asdf');
end;
end.
如果我使用 CTRL+单击ITestInterfataUnit,它会将我带到正确位置的正确单元。我在这里看到过这样的问题,并且我已经尝试了我在那里看到的所有解决方案。
- 再次创建项目
- 关闭并打开 Delphi IDE
- 检查接口单元是否在
uses主窗体中声明 - 确保我为该单元命名,这样就不会有其他同名的 .dcu 文件。
【问题讨论】:
标签: delphi