这是我收到错误的代码部分:
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, cefvcl, Vcl.ExtCtrls, Vcl.StdCtrls, ceflib,
Vcl.ComCtrls, Vcl.ImgList, Vcl.Imaging.pngimage, Vcl.Buttons, JvSpeedButton, Themes,
JvExComCtrls, JvComCtrls, JvgPage, Vcl.ToolWin, JvToolBar, Vcl.Menus,
Vcl.Mask, JvExMask, JvToolEdit, JvExButtons, JvButtons, rkSmartTabs, rkAeroTabs;
type
TForm1 = class(TForm)
{....}
procedure FormCreate(Sender: TObject);
procedure addnewtab (Sender: TObject);
procedure closetab (Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{....}
procedure TForm1.closetab (Sender: TObject);
var
smarttabs: TrkAeroTabs;
begin
smarttabs := Sender as TrkAeroTabs;
smarttabs.DeleteTab(smarttabs.ActiveTab);
end;
procedure TForm1.addnewtab (Sender: TObject);
var
smarttabs: TrkAeroTabs;
begin
smarttabs := Sender as TrkAeroTabs;
smarttabs.AddTab('New Tab');
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
with TrkAeroTabs.Create(self) do
begin
OnCloseTab := closetab; //***ERROR HERE***
OnAddClick := addnewtab;
Parent := Self;
Align := alClient;
AddTab('New Tab');
if ClassType = TrkAeroTabs then
begin
ColorBackground := clBlack;
with Self do
begin
GlassFrame.Top := 25;
GlassFrame.Enabled := True;
end;
end;
ShowButton := True;
AllowTabDrag := True;
end;
end;
这是错误:
[DCC Error] Unit1.pas(90): E2009 Incompatible types: 'Parameter lists differ'
addnewtab() 工作正常。我不明白为什么 closetab() 不起作用。谢谢。