TCustomForm has a protected procedure defined as:
procedure TCustomForm.VisibleChanging; begin if (FormStyle = fsMDIChild) and Visible and (Parent = nil) then raise EInvalidOperation.Create(SMDIChildNotVisible); end;
Override it in the MDI child windows as:
procedure TMDIChildForm.VisibleChanging; begin // :-P end;
Here is a simple example
After reading Jeroen's comment, I tried another solution that also works, but with a little flicker:
procedure TMDIChildForm.VisibleChanging; begin if Visible then FormStyle := fsNormal else FormStyle := fsMDIChild; end;
Perhaps this works on all versions of Windows.
PS: I did not find problems with the first solution for Windows 2k3SP2 x86 and Windows 7 Ultimate x86
source share