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

TStrings.BeginUpdate

Mark the beginning of an update batch.

Declaration

Source position: classesh.inc line 484

public procedure TStrings.BeginUpdate;

Description

BeginUpdateincreases the update count by one. It is advisable to call BeginUpdatebefore lengthy operations on the stringlist. At the end of these operation, TStrings.EndUpdateshould be called to mark the end of the operation. Descendent classes may use this information to perform optmizations. e.g. updating the screen only once after many strings were added to the list.

All TStringsmethods that modify the string list call BeginUpdatebefore the actual operation, and call endUpdatewhen the operation is finished. Descendent classes should also call these methods when modifying the string list.

Remark:

Always put the corresponding call to TStrings.EndUpdatein the context of a Finallyblock, to ensure that the update count is always descreased at the end of the operation, even if an exception occurred:

With MyStrings do
    try
      BeginUpdate;
      // Some lengthy operation.
    Finally
      EndUpdate
    end;  

See also

TStrings.EndUpdate

  

Mark the end of an update batch.