Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. Modal dialogs shown in the alt-tab window list

Modal dialogs shown in the alt-tab window list

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpwinformshelpquestion
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dave Bryant
    wrote on last edited by
    #1

    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

    Dave http://www.cloudsofheaven.org

    F 1 Reply Last reply
    0
    • D Dave Bryant

      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

      Dave http://www.cloudsofheaven.org

      F Offline
      F Offline
      Fahad Sadah
      wrote on last edited by
      #2

      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

      D 1 Reply Last reply
      0
      • F Fahad Sadah

        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

        D Offline
        D Offline
        Dave Bryant
        wrote on last edited by
        #3

        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.

        Dave http://www.cloudsofheaven.org

        P 1 Reply Last reply
        0
        • D Dave Bryant

          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.

          Dave http://www.cloudsofheaven.org

          P Offline
          P Offline
          Pete OHanlon
          wrote on last edited by
          #4

          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.

          L 1 Reply Last reply
          0
          • P Pete OHanlon

            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.

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #5

            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


            P 1 Reply Last reply
            0
            • L Luc Pattyn

              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


              P Offline
              P Offline
              Pete OHanlon
              wrote on last edited by
              #6

              Ah. Glad I haven't lost my mind. Thanks for link.

              Deja View - the feeling that you've seen this post before.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups