Home All Groups Group Topic Archive Search About
Author
6 Dec 2006 4:32 PM
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

Author
6 Dec 2006 4:59 PM
lord.zoltar
henpat wrote:
> 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.
Author
7 Dec 2006 7:54 AM
henpat
Thanks a lot.
It Works.

<lord.zol***@gmail.com> escribió en el mensaje
Show quoteHide quote
news:1165424361.822475.278620@16g2000cwy.googlegroups.com...
>
> henpat wrote:
>> 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.
>
Author
7 Dec 2006 7:27 PM
Martin
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.

<lord.zol***@gmail.com> wrote in message
Show quoteHide quote
news:1165424361.822475.278620@16g2000cwy.googlegroups.com...
>
> henpat wrote:
>> 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.
>
Author
7 Dec 2006 7:57 PM
lord.zoltar
Martin wrote:
Show quoteHide quote
> 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. ;)