Subject How to find the activer MDI Children
Author Norman Dunbar
Morning Paul,

>> The problem as I see it, is that
>> each form is an MDI Child, so it lives entirely on the stack. So it
>> would need to be able to do this dynamically. I guess I need to
>> think up plan B.

I get the IBO list in digest form so I haven't seen you post until now.

The parent MDI form has a property called MDIChildCount holding the number
of child forms it has open.
It also has an array of TForm called MDIChildren[]. New MDI Child forms are
added at index zero of this array !

From the help for MDIChildren (Granted it is C++ Builder but ......)

Provides indexed access to all MDI child forms.

__property TForm* MDIChildren[int I] = {read=GetMDIChildren};

Description

Use MDIChildren to access a child form.

I is the index of the child form to access. The index of the most recently
created MDI child is always 0, and the index of the first-created MDI child
is always MDIChildCount - 1 (the MDIChildren array is reverse-order of MDI
child creation).

MDIChildren is meaningful only if the form is an MDI parent (that is, if the
form's FormStyle property is set to fsMDIForm).

The following code closes all the MDI children of Form1.

void __fastcall TForm1::Button1Click(TObject *Sender)

{
for(int i = 0; i < MDIChildCount; i++)
MDIChildren[i]->Close();
}

Hope this helps with your problem.

Regards, Norman.
----------------------------------------------------------------------------
----
Norman Dunbar EMail: NDunbar@...
Database/Unix administrator Phone: 0113 289 6265
Lynx Financial Systems Ltd. Fax: 0113 201 7265
URL: http://www.LynxFinancialSystems.com
----------------------------------------------------------------------------
----