Back to Devexpress

TdxTabbedMDIPageChangingEvent Type

vcl-dxtabbedmdi-82e63b8a.md

latest2.6 KB
Original Source

TdxTabbedMDIPageChangingEvent Type

The OnPageChanging event’s procedural type.

Declaration

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

Parameters

NameType
SenderTObject
ANewPageTdxTabbedMDIPage
AAllowChangeBoolean

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:

ParameterDescription
SenderA tabbed MDI manager that raised the event.
ANewPageA 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.
AAllowChangeSpecifies 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:

delphi
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;
cpp
void __fastcall MyForm::dxTabbedMDIManager1PageChanging(TObject *Sender, TdxTabbedMDIPage *ANewPage, bool &AAllowChange)
{
if (dxTabbedMDIManager1->TabProperties->ActivePage->MDIChild == AChildForm) // Checks if the active MDI page is a form with editors whose content you need to verify
   {
      if ((AChildForm->cxTextEdit1->Text == "") || (AChildForm->cxTextEdit2->Text == ""))
    {
       AAllowChange = false;
       ShowMessage("There are empty fields. Save changes?");
     }
     }
}

See Also

dxTabbedMDI Unit