Sub OnMDIClose(Sender: Object; Args: IMDICloseEventArgs);
Begin
//set of operators;
End Sub OnMDIClose;
Sender - parameter that returns the component that has generated the event.
Args - parameter that enables the user to determine event parameters.
The OnMDIClose event occurs before the MDI child form is closed. This event must be processed for 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 canceled in the OnMDIClose handler, the procedure of child forms closing is stopped. The parent form is not closed. Child forms are closed in order reversed to creation (if child forms were created in order A->B->C , forms are closed in order C->B->A).
Executing the example requires a a form. This form is an 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 canceled.
See also: