I use the Hidden property to indicate if an item is currently available for activity or not (i.e. Archived). These items may be displayed or not.
Now I need to be able to filter the items based on complex filter criteria that is independent of its Hidden status.
If I had the following property and event (see below), then I could use the event to filter the items according to my filter.
I would still like Hidden to be independent of the filter, so that Hidden items may be displayed using FilteredVisibility = False, unless the filter rejects them.
The filter would be based on external criteria that is applied to an Item[]'s Text, Cells or Tag values or any other property of the Item[].
property TElXTree.Filtered : Boolean;
event: TElXTree.OnFilter(Sender ; TObject; Item : TElXTreeItem; FilterItem : Boolean);
e.g.
if ( pos('cat', Item.Text) > 0
(or (TObjectList<TMyObject>(Data).DateDone < Today() - 6)
and (CalcTotalTime(Item) < 1)
and (Item.Tag > 0) then
begin
FilterItem := True;
end
else
begin
FilterItem := False;
end;
A Hidden item is to be filtered like any non-Hidden item.
Of course, if an item is Hidden and FilteredVisibility = True, then there would not be any need to call the event TElXTree.OnFilter(...).
Thank you.
Raymond
Comments