Download Now

    Reference TNotifyCollection<T>

    Declared in Codebot.Controls.pas on line 42

    TNotifyCollection<T> simplifies creating specialized persistent collections
      TNotifyCollection<T: TCollectionItem> = class(TCollection)
      protected
        function GetOwner: TPersistent; override;
        { Invoke OnItemNotify subscribers }
        procedure Notify(Item: TCollectionItem; Action: TCollectionNotification); override;
        { Invoke OnItemUpdate subscribers }
        procedure Update(Item: TCollectionItem); override;
      public
        { Create a collection owned by a persistent object }
        constructor Create(AOwner: TPersistent); virtual;
        destructor Destroy; override;
        { Copy the items of another collection }
        procedure Assign(Source: TPersistent); override;
        { Add a new item }
        function Add: T;
        { The object which owns the collection }
        property Owner: TPersistent read FOwner;
        { Items indexed by an integer }
        property Items[const Index: Integer]: T read GetItem write SetItem; default;
        { Subscribe to notifications when items are added or removed }
        property OnItemNotify: IItemNotifyDelegate read GetOnItemNotify;
        { Subscribe to notifications when items change }
        property OnItemUpdate: IItemUpdateDelegate read GetOnItemUpdate;
      end;

    See also