A
AHLKJ
Unregistered / Unconfirmed
GUEST, unregistred user!
我使用的是 ExpressQuantumGrid.Suite.v5.11 ,我在新建一个空白项目的时候使用此控件编译运行程序没有任何问题.
当我把控件加到我以前做的一个项目里面的时候不能编译(以前的项目可以正常编译执行的),错误信息如下:
[Error] cxDBFilter.pas(62): Undeclared identifier: 'TcxDBAdapterItem'
[Error] cxDBFilter.pas(62): Class type required
[Error] cxDBFilter.pas(71): Undeclared identifier: 'TcxDBAdapterList'
[Error] cxDBFilter.pas(82): Operator not applicable to this operand type
[Error] cxDBFilter.pas(92): Incompatible types: 'TcxDBFilterOperatorAdapter' and 'String'
[Error] cxDBFilter.pas(97): Statement expected but 'FUNCTION' found
[Error] cxDBFilter.pas(119): Missing operator or semicolon
[Error] cxDBFilter.pas(120): Missing operator or semicolon
[Error] cxDBFilter.pas(123): Missing operator or semicolon
[Error] cxDBFilter.pas(50): Unsatisfied forward or external declaration: 'TcxFilterSQLNullOperator.FilterText'
[Fatal Error] cxDBData.pas(44): Could not compile used unit 'cxDBFilter.pas'
cxDBFilter.pas 内容如下:
unit cxDBFilter;
{$I cxVer.inc}
interface
uses
DB, cxFilter, cxDB;
type
{ TcxFilterSQLNullOperator }
TcxFilterSQLNullOperator = class(TcxFilterNullOperator)
public
function FilterText: string; override;
end;
{ TcxFilterSQLNotNullOperator }
TcxFilterSQLNotNullOperator = class(TcxFilterNotNullOperator)
public
function FilterText: string; override;
end;
{ TcxDBFilterOperatorAdapter }
TcxDBFilterOperatorAdapter = class(TcxDBAdapterItem)
public
procedure PrepareOperatorClass(ASender: TObject; ADataSet: TDataSet;
var AOperatorClass: TcxFilterOperatorClass); virtual;
end;
function cxGetFilterOperatorAdapter(ADataSet: TDataSet): TcxDBFilterOperatorAdapter;
var
cxFilterOperatorAdapters: TcxDBAdapterList;
implementation
uses
SysUtils;
function cxGetFilterOperatorAdapter(ADataSet: TDataSet): TcxDBFilterOperatorAdapter;
var
AIndex: Integer;
begin
if Assigned(ADataSet) and cxFilterOperatorAdapters.FindAdapter(TDataSetClass(ADataSet.ClassType), AIndex) then
Result := cxFilterOperatorAdapters[AIndex] as TcxDBFilterOperatorAdapter
else
Result := nil;
end;
{ TcxFilterSQLNullOperator }
function TcxFilterSQLNullOperator.FilterText: string;
begin
Result := 'IS';
end;
{ TcxFilterSQLNotNullOperator }
function TcxFilterSQLNotNullOperator.FilterText: string;
begin
Result := 'IS NOT';
end;
{ TcxDBFilterOperatorAdapter }
procedure TcxDBFilterOperatorAdapter.PrepareOperatorClass(ASender: TObject;
ADataSet: TDataSet; var AOperatorClass: TcxFilterOperatorClass);
begin
if AOperatorClass.InheritsFrom(TcxFilterNullOperator) or
AOperatorClass.InheritsFrom(TcxFilterNotNullOperator) then
begin
if Pos(AnsiUpperCase('Query'), AnsiUpperCase(ADataSet.ClassName)) <> 0 then
if AOperatorClass.InheritsFrom(TcxFilterNotNullOperator) then
AOperatorClass := TcxFilterSQLNotNullOperator
else
AOperatorClass := TcxFilterSQLNullOperator;
end;
end;
initialization
cxFilterOperatorAdapters := TcxDBAdapterList.Create;
cxFilterOperatorAdapters.RegisterAdapter(TDataSet, TcxDBFilterOperatorAdapter);
finalization
cxFilterOperatorAdapters.Free;
cxFilterOperatorAdapters := nil;
end.
cxDB.pas 中有 TcxDBAdapterItem 类的定义.
当我把控件加到我以前做的一个项目里面的时候不能编译(以前的项目可以正常编译执行的),错误信息如下:
[Error] cxDBFilter.pas(62): Undeclared identifier: 'TcxDBAdapterItem'
[Error] cxDBFilter.pas(62): Class type required
[Error] cxDBFilter.pas(71): Undeclared identifier: 'TcxDBAdapterList'
[Error] cxDBFilter.pas(82): Operator not applicable to this operand type
[Error] cxDBFilter.pas(92): Incompatible types: 'TcxDBFilterOperatorAdapter' and 'String'
[Error] cxDBFilter.pas(97): Statement expected but 'FUNCTION' found
[Error] cxDBFilter.pas(119): Missing operator or semicolon
[Error] cxDBFilter.pas(120): Missing operator or semicolon
[Error] cxDBFilter.pas(123): Missing operator or semicolon
[Error] cxDBFilter.pas(50): Unsatisfied forward or external declaration: 'TcxFilterSQLNullOperator.FilterText'
[Fatal Error] cxDBData.pas(44): Could not compile used unit 'cxDBFilter.pas'
cxDBFilter.pas 内容如下:
unit cxDBFilter;
{$I cxVer.inc}
interface
uses
DB, cxFilter, cxDB;
type
{ TcxFilterSQLNullOperator }
TcxFilterSQLNullOperator = class(TcxFilterNullOperator)
public
function FilterText: string; override;
end;
{ TcxFilterSQLNotNullOperator }
TcxFilterSQLNotNullOperator = class(TcxFilterNotNullOperator)
public
function FilterText: string; override;
end;
{ TcxDBFilterOperatorAdapter }
TcxDBFilterOperatorAdapter = class(TcxDBAdapterItem)
public
procedure PrepareOperatorClass(ASender: TObject; ADataSet: TDataSet;
var AOperatorClass: TcxFilterOperatorClass); virtual;
end;
function cxGetFilterOperatorAdapter(ADataSet: TDataSet): TcxDBFilterOperatorAdapter;
var
cxFilterOperatorAdapters: TcxDBAdapterList;
implementation
uses
SysUtils;
function cxGetFilterOperatorAdapter(ADataSet: TDataSet): TcxDBFilterOperatorAdapter;
var
AIndex: Integer;
begin
if Assigned(ADataSet) and cxFilterOperatorAdapters.FindAdapter(TDataSetClass(ADataSet.ClassType), AIndex) then
Result := cxFilterOperatorAdapters[AIndex] as TcxDBFilterOperatorAdapter
else
Result := nil;
end;
{ TcxFilterSQLNullOperator }
function TcxFilterSQLNullOperator.FilterText: string;
begin
Result := 'IS';
end;
{ TcxFilterSQLNotNullOperator }
function TcxFilterSQLNotNullOperator.FilterText: string;
begin
Result := 'IS NOT';
end;
{ TcxDBFilterOperatorAdapter }
procedure TcxDBFilterOperatorAdapter.PrepareOperatorClass(ASender: TObject;
ADataSet: TDataSet; var AOperatorClass: TcxFilterOperatorClass);
begin
if AOperatorClass.InheritsFrom(TcxFilterNullOperator) or
AOperatorClass.InheritsFrom(TcxFilterNotNullOperator) then
begin
if Pos(AnsiUpperCase('Query'), AnsiUpperCase(ADataSet.ClassName)) <> 0 then
if AOperatorClass.InheritsFrom(TcxFilterNotNullOperator) then
AOperatorClass := TcxFilterSQLNotNullOperator
else
AOperatorClass := TcxFilterSQLNullOperator;
end;
end;
initialization
cxFilterOperatorAdapters := TcxDBAdapterList.Create;
cxFilterOperatorAdapters.RegisterAdapter(TDataSet, TcxDBFilterOperatorAdapter);
finalization
cxFilterOperatorAdapters.Free;
cxFilterOperatorAdapters := nil;
end.
cxDB.pas 中有 TcxDBAdapterItem 类的定义.