-
Notifications
You must be signed in to change notification settings - Fork 43
Open
Description
I want to select from a list of Children of an FMX object all those that support a specific interface, but trying something like the following won't work since there's a plain AsTObjectList that returns a list of TObject, but not one that could return the type you tell it to. Internally the AsTList would use "as OutT" and return TList
Is there some other way to pull this out with a clean syntax?
type TStoryItemCollection = TList;
function TStoryItem.GetStoryItems: TStoryItemCollection;
var IsStoryItem: TPredicate;
begin
IsStoryItem := function(obj: TFmxObject): Boolean
begin
Result := Supports(obj, IStoryItem);
end;
result := ObjectQuery.Select.From(Children).Where(IsStoryItem).AsTList(false);
end;
Metadata
Metadata
Assignees
Labels
No labels