MDI Parent Forms

  • Thread starter Thread starter henpat
  • Start date Start date
H

henpat

Hello all
I have a MDI Parent Form with some childs.
I need to know how can I setup a child form in order to disable access for
other forms "in the back".
I need that only the active form be available until the user closes it.

Thanks a lot.
henpat
 
henpat said:
Hello all
I have a MDI Parent Form with some childs.
I need to know how can I setup a child form in order to disable access for
other forms "in the back".
I need that only the active form be available until the user closes it.

Thanks a lot.
henpat

You could use ShowDialog:

MyModalForm.ShowDialog(MyMDIParentForm)

The modal form won't be a true MDI child (I don't think, but I've never
properly checked), but it works fine for me in similar situations, and
it still makes the MDI parent form the owner of the modal form.
 
Thanks a lot.
It Works.

You could use ShowDialog:

MyModalForm.ShowDialog(MyMDIParentForm)

The modal form won't be a true MDI child (I don't think, but I've never
properly checked), but it works fine for me in similar situations, and
it still makes the MDI parent form the owner of the modal form.
 
Hi,

I tried this as I would like something similar in my program under certain
circumstances, but if I set the MDIParent property of the child form to my
MDI form, when I call ShowDialog(MDIForm) I get an error:
----------------------------------------------------------------------------
Form that is not a top-level form cannot be displayed as a modal dialog box.
Remove the form from any parent form before calling showDialog.
----------------------------------------------------------------------------

If I do not set the MDIParent property then the modal form isn't contained
within the MDI form and that rather defeats the object of using an MDI
container form.

Have I missed something obvious or is this what you mean by 'The modal form
won't be a true MDI child '?

Thanks,

Martin.
 
Martin said:
Hi,

I tried this as I would like something similar in my program under certain
circumstances, but if I set the MDIParent property of the child form to my
MDI form, when I call ShowDialog(MDIForm) I get an error:
----------------------------------------------------------------------------
Form that is not a top-level form cannot be displayed as a modal dialog box.
Remove the form from any parent form before calling showDialog.
----------------------------------------------------------------------------

If I do not set the MDIParent property then the modal form isn't contained
within the MDI form and that rather defeats the object of using an MDI
container form.

Have I missed something obvious or is this what you mean by 'The modal form
won't be a true MDI child '?

Thanks,

Martin.

I don't have the code in front of me, but when I don't think I set a
MDIParent for the modal dialogue. I think I just set the MDIParent as
the Owner of the form, but did not set it as the MDIParent. So yeah , I
guess the modal form won't be a "true MDIChild" form. For me this
kludge works fine. If you can get the child form to be a True MDIChild
AND modal, I'd be interested to know how. ;)
 
Back
Top