R,

Thanks for all the code.... One small problem. The Window Menu does not get
populated...... I have set my MDI Form (FormStyle = fsMDIForm) WindowMenu
property to a menu item. As a test I create the following forms with the
following code:

procedure TfrmMDIMain.mnuMainFileOpenClick(Sender: TObject);
var
   F, F2 : TfrmLayoutInstance;
begin
     Application.CreateForm(TfrmLayoutInstance, F);
     F.Caption := IntToStr(frmMDIMain.MDIChildCount);
     F.NamNAMEditor1.LoadNAMFile(ExtractFilePath(Application.ExeName) +
'Test.NAM');
     Application.CreateForm(TfrmLayoutInstance, F2);
     F2.Caption := IntToStr(frmMDIMain.MDIChildCount);
     F2.NamNAMEditor1.LoadNAMFile(ExtractFilePath(Application.ExeName) +
'Test2.NAM');
end;

(TfrmLayoutInstance.FormStyle = fsMDIChild) But nothing appears in the
Window Menu. Something real obvious here that I am missing.......

------------------------------------------------------------------------
--Donovan
Donovan J. Edye [www.edye.wattle.id.au]
Namadgi Systems, Delphi Developer
Web: www.namsys.com.au E-Mail: [EMAIL PROTECTED]
Voice: +61 2 6285-3460 Fax: +61 2 6285-3459
TVisualBasic = Class(None);
GXExplorer [http://www.gexperts.com/gxexplorer/] Freeware Windows Explorer
replacement. Also includes freeware delphi windows explorer components.
------------------------------------------------------------------------


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Rohit Gupta
Sent: Tuesday, 19 September 2000 19:45
To: Multiple recipients of list delphi
Subject: Re: [DUG]: [Q] MDI - Child Windowns....


Some is built in, other you have to do... heres my code...

procedure Tfrm_App_Main.mniCascadeClick(Sender: TObject);
begin
  Cascade;
end;

procedure Tfrm_App_Main.mniTileClick(Sender: TObject);
begin
  Tile;
end;

procedure Tfrm_App_Main.mniArrangeIconsClick(Sender: TObject);
begin
  ArrangeIcons;
end;

procedure Tfrm_App_Main.mniPrintWindowClick(Sender: TObject);
begin
  if ActiveMDICHild <> nil
  then if Confirm ('Print current window ?',mrYes) = mrYes
       then ActiveMDIChild.Print;
end;

procedure Tfrm_App_Main.mniMinimizeWinClick(Sender: TObject);
begin
  if ActiveMDIChild <> nil
  then with ActiveMDIChild
       do if biSystemMenu in BorderIcons
          then WindowState := wsMinimized;
end;

procedure Tfrm_App_Main.mniMinimizeAllClick(Sender: TObject);
var
  I: Integer;
begin
  { Must be done backwards through the MDIChildren array }
  for I := MDIChildCount - 1 downto 0
  do with MDIChildren[I]
     do if biSystemMenu in BorderIcons
        then WindowState := wsMinimized;
end;

procedure Tfrm_App_Main.mniCloseWindowClick(Sender: TObject);
begin
  if ActiveMDIChild <> nil
  then ActiveMDIChild.Close;
end;

procedure Tfrm_App_Main.mniCloseAllClick(Sender: TObject);
var
  I: Integer;
begin
  { Close Active Forms first }
  for I := MDIChildCount - 1 downto 0
  do if MDIChildren[I].Enabled
     then MDIChildren[I].Close;
  Application.ProcessMessages;
  { Now Close the Rest }
  for I := MDIChildCount - 1 downto 0
  do MDIChildren[I].Close;
end;

procedure Tfrm_App_Main.UpdateMenuItems(Sender: TObject);
var
  Ok : Boolean;
begin
  Ok                        := MDIChildCount > 0;
  mniCascade.Enabled        := Ok;
  mniTile.Enabled           := Ok;
  mniArrangeIcons.Enabled   := Ok;
  mniMinimizeWindow.Enabled := Ok;
  mniMinimizeAll.Enabled    := Ok;
  mniCloseWindow.Enabled    := Ok;
  mniCloseAll.Enabled       := Ok;
end;

Above triggered thusly...

  Screen.OnActiveFormChange := UpdateMenuItems;

And set the MainForm.WindowMenu to point to the menu you want the open forms
to appear in.

Regards

-----Original Message-----
From: Donovan J. Edye <[EMAIL PROTECTED]>
To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
Date: Tuesday, 19 September 2000 19:03
Subject: [DUG]: [Q] MDI - Child Windowns....


G'Day,

I am writing an MDI app and need to implement the standard Window Menu (One
that shows all the open MDI children). What is the best way to maintain that
menu item? Is there something built into Delphi that notifies you when
children are destroyed etc. I am sure I am missing something obvious
here......

TIA

------------------------------------------------------------------------
--Donovan
Donovan J. Edye [www.edye.wattle.id.au]
Namadgi Systems, Delphi Developer
Web: www.namsys.com.au E-Mail: [EMAIL PROTECTED]
Voice: +61 2 6285-3460 Fax: +61 2 6285-3459
TVisualBasic = Class(None);
GXExplorer [http://www.gexperts.com/gxexplorer/] Freeware Windows Explorer
replacement. Also includes freeware delphi windows explorer components.
------------------------------------------------------------------------

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to