Board index » delphi » can i hide a MDIChild form ?

can i hide a MDIChild form ?

i have a MDIChild form which creates another MDIChild form.

can i hide this form while it's child remains focused and then show it
again when we exit the child form ?

Thanks

 

Re:can i hide a MDIChild form ?


MDI Child forms are children of the MDI main form, not of each other.
An MDI Child form is always visible until it is freed using
Action=caFree in the Close event for the form. You could possible use
some "tricks" to accomplish this, such as using paths to paint the
form invisible.

Woody

Quote
khng wrote in message

<01bdc015$592539e0$0d00a8c0@khng_pc.dbix.com.my>...
Quote
>i have a MDIChild form which creates another MDIChild form.

>can i hide this form while it's child remains focused and then show
it
>again when we exit the child form ?

>Thanks

Re:can i hide a MDIChild form ?


You can minimize the form when the "child" is created, and normalize the
form again when the child is closed.  This will create a small icon in the
lower part of the mdi parent's form, and is not the same as hiding it
completely.  You may find that acceptable.
Quote
khng wrote:
> i have a MDIChild form which creates another MDIChild form.

> can i hide this form while it's child remains focused and then show it
> again when we exit the child form ?

> Thanks

Re:can i hide a MDIChild form ?


On 5 Oct 1998 01:55:09 GMT, "khng" <k...@dbix.com.my> wrote:

Quote
>i have a MDIChild form which creates another MDIChild form.

>can i hide this form while it's child remains focused and then show it
>again when we exit the child form ?

It's Delphi that's preventing an MDI child of being hidden.
Override the VisibleChanging method and don't call inherited:

procedure TMDIChildForm.VisibleChanging;
begin
  // Delphi doesn't allow an MDI child to be hidden
end;

Then intercept WM_SHOWWINDOW to avoid a problem with hiding a
maximized MDI child:

procedure TMDIChildForm.WMShowWindow(var Message: TWMShowWindow);
begin
  inherited;
  // Solve problem with MDI title when maximized window was hidden
  if not Message.Show and not Visible and
     (FormStyle = fsMDIChild) and
     (WindowState = wsMaximized) and
     (MainForm.MDIChildCount = 1) then
    WindowState := wsNormal;
end;

You can then call MDIChildForm.Hide.

Please let me know if this works for you.  I've not seen any side
effects of this code so far, but I only use this to hide a window that
still has an SQL query thread running, and close it up automatically
afterwards.

Jan

Other Threads