MDIChildren (C++)

From RAD Studio Code Examples
Revision as of 12:10, 3 November 2011 by L10nBot (talk | contribs) (normalized vcl links)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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