Modal dialogs shown in the alt-tab window list
-
Hi all, I've got a C# WinForms application where the top-level form displays a modal dialog to allow the user to set some options. I create it very simply as follows:
using (MyForm form = new MyForm())
{
form.ShowDialog(this);
}I've turned off the ShowInTaskbar property for the dialog, so it doesn't show up in the taskbar. However, if you press Alt-Tab, it appears in the window list. That itself is not too much of a problem (it just looks bad and can be a little annoying if you're trying to switch between two apps). However, you can use Alt-Tab to switch back to the parent form even though it is currently showing the modal dialog. I'm unable to use the mouse to do anything with the parent form, BUT I can use keyboard accelerators to use menus on the parent form (with bad consequences). I've worked around this by explicitly disabling and enabling the parent form while displaying the dialog. So I have two questions: 1) Any ideas for how I can stop my modal dialog appearing in the Alt-Tab window list? I presume it appears there because it is a top-level form, but .NET doesn't seem to like showing non-top-level forms as modal dialogs. 2) Is the approach of disabling and enabling the parent the best approach here? Or am I just missing something obvious? Thanks, Dave
-
Hi all, I've got a C# WinForms application where the top-level form displays a modal dialog to allow the user to set some options. I create it very simply as follows:
using (MyForm form = new MyForm())
{
form.ShowDialog(this);
}I've turned off the ShowInTaskbar property for the dialog, so it doesn't show up in the taskbar. However, if you press Alt-Tab, it appears in the window list. That itself is not too much of a problem (it just looks bad and can be a little annoying if you're trying to switch between two apps). However, you can use Alt-Tab to switch back to the parent form even though it is currently showing the modal dialog. I'm unable to use the mouse to do anything with the parent form, BUT I can use keyboard accelerators to use menus on the parent form (with bad consequences). I've worked around this by explicitly disabling and enabling the parent form while displaying the dialog. So I have two questions: 1) Any ideas for how I can stop my modal dialog appearing in the Alt-Tab window list? I presume it appears there because it is a top-level form, but .NET doesn't seem to like showing non-top-level forms as modal dialogs. 2) Is the approach of disabling and enabling the parent the best approach here? Or am I just missing something obvious? Thanks, Dave
The only keyboard shortcut that Microsoft allow you to disable, by a happy chance, is alt+tab. Set alt+tab as a key combination, and have the response to it be a
System.Windows.Forms.MessageBox.Show("I am offended by your choice to switch to another program")
About the lock thing-use an if() to disable the shortcuts in the parent until the child is closed!All of my programs are downloadable at fahadsadah.co.nr
-
The only keyboard shortcut that Microsoft allow you to disable, by a happy chance, is alt+tab. Set alt+tab as a key combination, and have the response to it be a
System.Windows.Forms.MessageBox.Show("I am offended by your choice to switch to another program")
About the lock thing-use an if() to disable the shortcuts in the parent until the child is closed!All of my programs are downloadable at fahadsadah.co.nr
I was thinking more along the lines of not showing the dialog in the alt-tab list in the first place, rather than preventing alt-tab use altogether - that would be extremely annoying to some people.
-
I was thinking more along the lines of not showing the dialog in the alt-tab list in the first place, rather than preventing alt-tab use altogether - that would be extremely annoying to some people.
It would indeed, and I must admit I hadn't noticed that a C# modal dialog created its own window in the Alt-Tab list. It looks like I've got some fixing to do (once you figure out what the cause is).
Deja View - the feeling that you've seen this post before.
-
It would indeed, and I must admit I hadn't noticed that a C# modal dialog created its own window in the Alt-Tab list. It looks like I've got some fixing to do (once you figure out what the cause is).
Deja View - the feeling that you've seen this post before.
Hi Pete, This blog[^] calls it a bug in Windows XP PowerToy Task Switcher. And it fits with my experience: - regular Alt-Tab works as expected; - PowerToy shows both form and its modal dialog whatever properties you set. :)
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google
-
Hi Pete, This blog[^] calls it a bug in Windows XP PowerToy Task Switcher. And it fits with my experience: - regular Alt-Tab works as expected; - PowerToy shows both form and its modal dialog whatever properties you set. :)
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google
Ah. Glad I haven't lost my mind. Thanks for link.
Deja View - the feeling that you've seen this post before.