MDIChildren (Delphi)

From RAD Studio XE3 Code Examples
Jump to: navigation, search

Language:

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 the code for the CloseChildrenClick handler. When you choose the CloseChildren command, all the MDI children of Form1 are closed.

Code

procedure TForm1.CloseChildrenClick(Sender: TObject);
var
  I: Integer;
begin
  with Form1 do
    for I := MDIChildCount-1 downto 0 do
      MDIChildren[I].Close;
end;
 
procedure TForm1.MyArrangeIconsClick(Sender: TObject);
begin
  Form1.ArrangeIcons;
end;
 
procedure TForm1.MyCascadeClick(Sender: TObject);
begin
  Form1.Cascade;
end;

Uses

Personal tools