IFormControl.BeginUpdate

Syntax

BeginUpdate([Value: ControlsUpdateMode = 0]);

Parameters

ControlsUpdateMode. Recalculate form components' size.

Description

The BeginUpdate method deactivates form rerendering.

Comments

The method is used to speed up the work when a great number of components are created dynamically. After calling this method and till the EndUpdate method is called, the form rerendering is disabled on form or components resize. Changing the TabOrder value does not affect the order of components displaying. The internal events of the form are disabled. Use the EndUpdate method to resume form rerendering and apply all changes.

Example

Executing the example requires a form, the Button1 button on the form, and a panel named Panel1.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    Edit1, Edit2: IEditBox;
Begin
    Self.BeginUpdate(ControlsUpdateMode.LockResizeOnUpdate);
    Edit1 := New EditBox.Create;
    Edit2 := New EditBox.Create;
    Edit1.Parent := Panel1;
    Edit2.Parent := Panel1;
    Edit1.Anchors.Right := 100;
    Edit2.Anchors.Right := 100;
    Edit1.Text := "Value 1:";
    Edit2.Text := "Value 2:";
    Edit2.Top := Edit1.Top + Edit1.Height;
    Self.EndUpdate;
End Sub Button1OnClick;

On clicking the button two text editors are created on the panel. Form rerendering is disabled before components creation to speed up the process. All the changes are applied after the components are created and their properties are set up.

See also:

IFormControl