Unit 'Classes' Package
[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] [#rtl]

TStrings.BeginUpdate

Mark the beginning of an update batch.

Declaration

Source position: classesh.inc line 1006

public procedure TStrings.BeginUpdate;

Description

BeginUpdate increases the update count by one. It is advisable to call BeginUpdate before lengthy operations on the stringlist. At the end of these operation, TStrings.EndUpdate should be called to mark the end of the operation. Descendant classes may use this information to perform optimizations. e.g. updating the screen only once after many strings were added to the list.

All TStrings methods that modify the string list call BeginUpdate before the actual operation, and call endUpdate when the operation is finished. Descendant classes should also call these methods when modifying the string list.

Remark:

Always put the corresponding call to TStrings.EndUpdate in the context of a Finally block, to ensure that the update count is always decreased 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.


Documentation generated on: Dec 25 2024