activate

activate();

The activate event of the Form class occurs when a form becomes the active window.

When an MDI frame containing MDI child forms is made active, the MDI frame and the active child both receive activate events (in that order).

When moving between child forms of an MDI frame, only the child forms receive an activate event. Similarly, if the last active child is destroyed, the MDI frame does not receive another activate event, as it is already active.

A form can become active by a user action, such as clicking a form or control, or by using the show or setFocus method in logic.

The activate event occurs only when a form is visible. For example, after a form loaded is created, it is not visible unless you use the show method or set the visible property of the form to true. The activate event occurs when moving the focus within an application (including MDI to non-MDI) and also to another application.

The method in the following example shows the use of the activate event.

activate() updating;
begin
    lCount.caption := theCollectionSize.String;
    self.resize;
end;