Delphi cxFilterControl在组件内部获取Filtertext
我有cxfilter控制我对TCollectionItems(TableCollection-Field(Items))的感觉。例如…Persons Table->Person\u ID、年龄、姓名等 我需要做的是。。。 将TcxFilterControl.FilterText保存为字符串,以便在之后使用它们 我可以在组件外部轻松获取FilterTextSample:=cxFilterControl1.FilterText,但通常情况下,条件由用户设置。我需要组件内部的FilterText 我所做的Delphi cxFilterControl在组件内部获取Filtertext,delphi,devexpress,delphi-xe,Delphi,Devexpress,Delphi Xe,我有cxfilter控制我对TCollectionItems(TableCollection-Field(Items))的感觉。例如…Persons Table->Person\u ID、年龄、姓名等 我需要做的是。。。 将TcxFilterControl.FilterText保存为字符串,以便在之后使用它们 我可以在组件外部轻松获取FilterTextSample:=cxFilterControl1.FilterText,但通常情况下,条件由用户设置。我需要组件内部的FilterText 我所
TMySampleComp = class(TComponent, IcxFilterControl)
private
FCriteria: TcxFilterControlCriteria;
function GetPropertiesClassFromFieldType(AFieldType: TFieldType): TcxCustomEditPropertiesClass;
private
function GetCaption(Index: Integer): string;
function GetCount: Integer;
function GetCriteria: TcxFilterCriteria;
function GetItemLink(Index: Integer): TObject;
function GetItemLinkID(Index: Integer): Integer;
function GetItemLinkName(Index: Integer): string;
function GetProperties(Index: Integer): TcxCustomEditProperties;
function GetValueType(Index: Integer): TcxValueTypeClass;
public
property Captions[Index: Integer]: string read GetCaption;
property Criteria: TcxFilterCriteria read GetCriteria;
property ItemLinkNames[Index: Integer]: string read GetItemLinkName;
property ItemLinkIDs[Index: Integer]: Integer read GetItemLinkID;
property ItemLinks[Index: Integer]: TObject read GetItemLink;
property Properties[Index: Integer]: TcxCustomEditProperties read GetProperties;
property ValueTypes[Index: Integer]: TcxValueTypeClass read GetValueType;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
end;
TField = class(TCollectionItem)
private
FEditProperties: TcxCustomEditProperties;
procedure CreateProperties;
procedure DestroyProperties;
procedure RecreateProperties;
procedure SetFieldType(const Value: TFieldType);
protected
procedure SetIndex(Value: Integer); override;
function GetDisplayName: string; override;
public
constructor Create(Collection: TCollection); override;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
property EditProperties: TcxCustomEditProperties read FEditProperties;
published
end;
一切正常,所有项目都可以通过TcxFilterControl->(FilterText)访问。任何人都可以给我一些建议,如何在组件中获取这些文本(例如…(PERSON\u ID>=12)?我需要一个函数
我的起点是:
procedure TdafUniqueSQLGenerate.GetFilterChangeValue(Sender:
TcxFilterCriteria;
const AFilterText: string);
var
vFilterText: string;
I: integer;
J: integer;
begin
if Sender is TcxFilterCriteria then
begin
vFilterText := Sender.FilterText;
vFilterText := StringReplace(vFilterText, '<> NULL', 'is not null', [rfReplaceAll]);
vFilterText := StringReplace(vFilterText, '= NULL', 'is null', [rfReplaceAll]);
end
else vFilterText := '';
if not vFilterText.IsEmpty then
begin
for I := 0 to Tables.Items[i].Fields.Count -1 do
过程TdafUniqueSQLGenerate.GetFilterChangeValue(发送方:
TCX过滤标准;
常量AFilterText:string);
变量
vFilterText:字符串;
I:整数;
J:整数;
开始
如果发送方是TcxFilterCriteria,则
开始
vFilterText:=发送方.FilterText;
vFilterText:=StringReplace(vFilterText'NULL','isnotnull',[rfReplaceAll]);
vFilterText:=StringReplace(vFilterText,'=NULL',is NULL',[rfReplaceAll]);
结束
else vFilterText:='';
如果不是vFilterText.IsEmpty,则
开始
对于表。项[I]。字段。计数-1 do
谢谢你的帮助,对不起我的英文!你能给我一个小例子说明你的问题吗?你在这里发布的代码无法编译。你能给我一个小例子说明你的问题吗?你在这里发布的代码无法编译。