Skip to main content

TdxTabbedMDIPageChangingEvent Type

The OnPageChanging event’s procedural type.

Declaration

TdxTabbedMDIPageChangingEvent = procedure(Sender: TObject; ANewPage: TdxTabbedMDIPage; var AAllowChange: Boolean) of object;

Parameters

Name Type
Sender TObject
ANewPage TdxTabbedMDIPage
AAllowChange Boolean

Remarks

This event occurs prior to a page switch so you can implement a custom response to this action. The table below lists the event’s parameters:

Parameter Description
Sender A tabbed MDI manager that raised the event.
ANewPage A page that is about to be jumped to. This parameter is nil if a user switches between pages via the Ctrl+Tab or Ctrl+Shift+Tab key combination.
AAllowChange Specifies if a user can leave the active page. OnPageChanging ignores this parameter if a user deletes the active page.

You can set the AAllow parameter to False to prevent a user from leaving the active page as shown in the code example below:

procedure MyForm.dxTabbedMDIManager1PageChanging(Sender: TObject;
  ANewPage: TdxTabbedMDIPage; var AAllowChange: Boolean);
begin
    if dxTabbedMDIManager1.TabProperties.ActivePage.MDIChild = AChildForm //  Checks if the active MDI page is a form with editors whose content you need to verify
      then
        begin
          if (AChildForm.cxTextEdit1.Text = '') or (AChildForm.cxTextEdit2.Text = '')
            then
              begin
                AAllowChange := False;
                ShowMessage('There are empty fields. Save changes?');
              end;
See Also