MDIChildren (C++)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example uses several forms. The first form has its FormStyle property set to MDIForm. The others have their FormStyle properties set to MDIChild and their Visible properties set to True. Add a main menu component and name one of the menu items CloseChildren. This is code for the CloseChildrenClick handler. When you choose the CloseChildren command, all the MDI children of Form1 are closed.

Code

void __fastcall TForm1::CloseChildrenClick(TObject *Sender)
{
  for(int i = MDIChildCount - 1; i >= 0; i--)
    MDIChildren[i]->Close();
}

void __fastcall TForm1::MyArrangeIconsClick(TObject *Sender)
{
  Form1->ArrangeIcons();
}

void __fastcall TForm1::MyCascadeClick(TObject *Sender)
{
  Form1->Cascade();
  }

Uses