MDI Modal Windows

  • Thread starter Thread starter Mitchell Vincent
  • Start date Start date
M

Mitchell Vincent

I think the answer was here, but it's expired and I can't figure out how
to get it. In fact, I think I asked the question before!

Anyway, I have the need to show an MDI child window modally, and I know
the docs say "you can't" , but there *must* be some kind of hack, work
around or magic to make this happen. Is there?

Thanks guys!
 
The docs say you can't because it's nonsense in the context of an MDI
interface in which all documents are available within the same application.
A modal window is a dialog. Create a form that does what you want and show
it using ShowDialog.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
Mitchel,

When you mean that you want only one mdi form, than you can look in the
mdichilds from the parent if it already exist.

If you want to stop all other mdiforms replying, see than the answer from
Bob.

I hope this helps,

Cor
 
Bob said:
The docs say you can't because it's nonsense in the context of an MDI
interface in which all documents are available within the same application.
A modal window is a dialog. Create a form that does what you want and show
it using ShowDialog.

Perhaps I'm not explaining myself well enough, 'modal' might not be the
absolute correct term.

I have an MDI child window that, if the user chooses, can click on an
item in a list to edit it. That edit window is tied to the window that
opened it, so I don't want the user to be able to go back to that window
without dismissing the called window first.
 
Mitchell,
| Perhaps I'm not explaining myself well enough, 'modal' might not be the
| absolute correct term.
Perhaps. :-|

| I have an MDI child window that, if the user chooses, can click on an
| item in a list to edit it. That edit window is tied to the window that
| opened it, so I don't want the user to be able to go back to that window
| without dismissing the called window first.
What happens if you have two MDI child windows open, one for Item 1 & one
for Item 2.

Are you saying that the user could select some element in the Item 1 form,
and you want to display a Item 1 Child form. Where Item 1 Child is modal in
relation to Item 1, but Modeless in relation to Item 2? In other words the
user could work with either Item 1 Child or Item 2 MDI windows, but not the
Item 1

Basically where you have a hierarichal window structure similar to:

- MDI Parent
- Item 1
- Item 1 Child
- Item 2

There is no built-in support for that as far as I know, right now I cannot
think of a workaround, however with effort (a lot of effort possibly) I
would think a workaround would be possible.

Hope this helps
Jay

| Bob Powell [MVP] wrote:
| > The docs say you can't because it's nonsense in the context of an MDI
| > interface in which all documents are available within the same
application.
| > A modal window is a dialog. Create a form that does what you want and
show
| > it using ShowDialog.
| >
|
| Perhaps I'm not explaining myself well enough, 'modal' might not be the
| absolute correct term.
|
| I have an MDI child window that, if the user chooses, can click on an
| item in a list to edit it. That edit window is tied to the window that
| opened it, so I don't want the user to be able to go back to that window
| without dismissing the called window first.
|
| --
| - Mitchell Vincent
| - kBilling - Invoices Made Easy!
| - http://www.k-billing.com
 
Cor said:
Mitchel,

When you mean that you want only one mdi form, than you can look in the
mdichilds from the parent if it already exist.

If you want to stop all other mdiforms replying, see than the answer from
Bob.

I hope this helps,

Cor

I'm doing that now and think that's what I'll do. Is it most proper to
put something like

For Each Child As Form In Global.MainWindow.MdiChildren

If Child.Text= "Whatever" Then

Global.MainWindow.ShowChild(Child)

End If

Next Child

In the Activated event (as opposed to the GotFocus or another) of the
window that I always want it to appear on top of?
 
Mitchell,

If I understand you well, than I would not use MDI forms for this, however
showdialogs.

If you want it you can center them over your mainform

That is in my opinion what Bob tells as well.

I hope this helps,

Cor
 
Mitchell,
|I think the answer was here, but it's expired and I can't figure out how
| to get it. In fact, I think I asked the question before!
BTW: You could always use Google Groups to search.

http://groups.google.com/

Hope this helps
Jay


|I think the answer was here, but it's expired and I can't figure out how
| to get it. In fact, I think I asked the question before!
|
| Anyway, I have the need to show an MDI child window modally, and I know
| the docs say "you can't" , but there *must* be some kind of hack, work
| around or magic to make this happen. Is there?
|
| Thanks guys!
|
| --
| - Mitchell Vincent
| - kBilling - Invoices Made Easy!
| - http://www.k-billing.com
 
As Jay suggests, there is no model for that. You need to either figure out
some way of doing it int he same window or, and this is an OTTOTH
suggestion, hide the original window, display another form and then reveal
the original window when the operations are complete and the second form
dismissed.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top