FIX: Re: MDI Minimize Bug not fixed since 1998

Apparently nobody has posted a fix, so let me post my own findings so far:

The problem is that Delphi has a procedure called something like
SetMDIClientFrame in the Forms unit;  (I think that is the correct name but
the PC I am writing this on does not have Delphi installed, so I can't
check).  When an MDI client window draws itself, there are two cases:

a) When the MDI children are in normal or iconised state, the client calls
SetMDIClientFrame (or whatever its name is) to draw a dropped 3D border
inside its client area.  The dropped border effectively reduces the size of
the client area by a few pixels all round.

b) When an MDI child is in zoomed state, the client calls SetMDIClientFrame
to remove the 3D border -- effectively growing the size of the client area
back to full size.

The bug that I am referring to is caused by the fact that when an MDI child
window goes from zoomed to iconised state, the following sequence occurs:

1) the MDI client area starts off at its full size
2) the MDI child is iconised to the bottom of the [full sized] MDI client
area
3) SetMDIClientFrame (or whatever its name is) is called to draw the 3D
client border, thus reducing the size of the client area, and so cutting off
the bottom few pixels of the child icon(s).

The proper fix to this bug would be to modify the code in the Forms unit so
that steps 2) and 3) occur in the reverse sequence. => REQUEST: can Borland
please do this in the next release?

A work around that does not require changing the Forms unit is to write a
handler to intercept the wmSysCommand for the MDI child window so as to
break down the one step sequence "zoomed -> iconised" into two steps
"zoomed -> normal -> iconised" as follows:

procedure TMDIChildForm.wmSysCommand(var Message : TWMSysCommand);
begin
  // only intercept the sequence zoomed -> iconised
  if ((Message.CmdType and $FFF0) = SC_MINIMIZE) and (WindowState =
wsMaximised) then
  begin
    // first take the window from zoomed -> normal (this draws the 3D client
border)
   WindowState := wsNormal;
    // then post a second SC_MINIMIZE to take the window from normal ->
iconised
    PostMessage(Handle, wm_SysCommand, SC_MINIMIZE, 0);
    exit;
  end;
  inherited;
end;

This doesn't look very slick on the screen, but it works nevertheless...

Regards,
Andrew FG

"Andrew Fiddian-Green" <andrewfg at zugernet dot ch> wrote in message
news:3dd0071e$1@newsgroups.borland.com...
Borland lists the following bug for Delphi 4 with the status "deferred to
next rel".  I am using Delphi 7 and the bug still exists!!

Does anyone have a fix?

Regards,

Andrew FG

--------

Area: vcl\core vcl classes\tform

Reference Number: 1341 (Published: 12/17/98)

Status: Deferred to Next Rel
Date Reported: 9/16/98

Severity: Commonly Encountered

Type: Minor Functionality Failure

Problem:

when minimizing a maximized MDI child Form, the
title bar gets placed a touch to low in the MDI
parent Form causing vertical scroll bars to appear in
the parent.