我有cxFilterControl我对TCollectionItems的感受(TableCollection - Field(Items)。例如......人员表 - > Person_ID,年龄,姓名等...
我需要做什么...... 保存TcxFilterControl。在
之后,将FilterText转换为字符串以与它们一起使用我可以在组件外部轻松获取FilterTextSample:= cxFilterControl1.FilterText,但通常情况是由用户设置的。我需要Component
中的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_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
感谢您的帮助,对不起我的Eng!