Cierto, se me pasó ese detalle, aquí te va una versión que toma en cuenta ese pequeño error...
Código Delphi
[-]
procedure TMDIForm.AllButtonClick(Sender: TObject);
var
NewMDIForm: TForm;
begin
if Self.ActiveMDIChild is MDIChildrenClass[TButton(Sender).Tag] then
begin
if ActiveMDIChild.WindowsState = wsMinimized then
ActiveMDIChild.WindowsState = wsNormal
end
else
begin
if Assigned(Self.ActiveMDIChild) then Self.ActiveMDIChild.Close;
NewMDIForm := MDIChildrenClass[TButton(Sender).Tag].Create(Application)
end
end;