Form.OnMDIClose

Syntax

Sub OnMDIClose(Sender: Object; Args: IMDICloseEventArgs);

Begin

//set of operators;

End Sub OnMDIClose;

Parameters

The Sender parameter returns the component that has generated the event.

The Args parameter allows to determine event parameters.

Description

The OnMDIClose event occurs before the MDI child form is closed. This event should be processed for the MDI main forms.

When the MDI main form is closed, all MDI child forms are closed and this event is generated for them. If MDI main form closing was cancelled in the OnMDIClose handler, the procedure of child forms closing is stopped. The parent form is not closed. Closing of child forms is performed in order reversed to creation (if child forms were created in order A->B->C , the form closing is performed in order C->B->A).

Example

For the example to be executed, a form should exist. This form is a MDI parent form that contains several child ones. The value of the Tag property of the MDI forms is changed during the form work.

Sub FormOnMDIClose(Sender: Object; Args: IMDICloseEventArgs);

Begin

If Args.MDIChild.Tag = 100 Then

Args.Allow := False;

End If;

End Sub FormOnMDIClose;

After executing the example, if the user tries to close the MDI child form, if its Tag property is 100, the form closing is cancelled.

See also:

Form