3050:TForm.MDIChildren[] Array and Form Creation
KEYWORDS: MDI Child MDIChildren MDIChild MDIChildCount AREA: VCL Programming
The documentation of TForm.MDIChildren[] states that the index
of the first-created MDI child is 0. This is incorrect -- 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.
With this in mind, you can use the following code to iterate
over the MDI child array from from the first-created to the
last:
procedure TForm1.IterateOverMDIChildren;
var
i: integer;
begin
for i := MDIChildCount - 1 downto 0 do begin
{ do something with MDI child here }
end;
end;
TI