[SOLVED] Non modal form

Answered
0
0

Hello – I’m trying to implement a non modal form that is also top most.

Basically – I want the form to remain open and available while the user interacts with the main form of the application.

I thought I could achieve this with .TopMost = True and also .Show instead of .ShowDialog.

But I cannot seem to make this work.  Am I doing something wrong?

Here is what I’ve found:

form.Show seems to behave like form.ShowDialog – they both show the form in a modal way – the user is unable to interact with the main form.

form.ShowModalMask = true | false – doesn’t seem to matter – it always shows the mask (dims the underlying main form).

 

Any suggestions on how I can achieve this?

 

Thanks in advance…

 

Matthew

  • You must to post comments
Best Answer
0
0

Hi Matthew,

From what you say above, it’s not easy to understand your exact use case. I think it would be easier if you attach a sample that shows the problem you describe.

Concerning modal/modeless windows on Wisej, there is a very simple rule:

  • once you open a modal window, all windows are modal

This has some consequences:

  1. A modal window can only open other modal windows. No matter whether you use Show() or ShowDialog() the open window will always behave like modal -you won’t be ableto click on underlying windows.
  2. If a modeless window opens a modal window, the underlying (modeless) window is no longer clickable.

In order to use true modeless windows, all windows in the chain must be modeless – no ShowDialog() on parent window, nor on grand-parent window, nor even on child windows, grand-child windows, etc

When you come to think about it, it makes no sense to have a modal showing a modeless. I can’t think of a single use case where you are working on a modal window and need to use a modeless window.

If you are using a Page application, you can open modal and modeless as child windows. If your application is a Form based application like MDI, in order to use modeless windows, your Program.cs file can’t ShowDialog() the main window but rather Show().

Please have a look at MDI Example at GibHub

I hope that helps. If not, please attach a sample.

  • You must to post comments
0
0

Thanks Tiago – the nuance of not being able to show a non modal form from a modal form is what was tripping me up.  I am going to find another way to implement the requirement.

Thanks for your help.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.