[Overview][Constants][Types][Classes][Procedures and functions][Variables] Reference for unit 'Classes' (#rtl)

TCollection.BeginUpdate

Start an update batch.

Declaration

Source position: classesh.inc line 404

public procedure TCollection.BeginUpdate;

Description

BeginUpdateis called at the beginning of a batch update. It raises the update count with 1.

Call BeginUpdateat the beginning of a series of operations that will change the state of the collection. This will avoid the call to TCollection.Updatefor each operation. At the end of the operations, a corresponding call to EndUpdatemust be made. It is best to do this in the context of a Try ... finallyblock:

With MyCollection Do
    try
      BeginUpdate;
      // Some Lengthy operations
    finally
      EndUpdate;
    end;  

This insures that the number of calls to BeginUpdatealways matches the number of calls to TCollection.EndUpdate, even in case of an exception.

See also

TCollection.EndUpdate

  

Ends an update batch.

TCollection.Changed

  

Procedure called if an item is added to or removed from the collection.

TCollection.Update

  

Hander called when an item in the collection has changed.