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. C#
  4. Deactivating a form...

Deactivating a form...

Scheduled Pinned Locked Moved C#
question
8 Posts 3 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.
  • S Offline
    S Offline
    Shy Agam
    wrote on last edited by
    #1

    Hello experts, An application I'm currently developing pops-up reminder windows. Being a popup window, it should not "steal" the focus, as it can be unpleasent to the user if he's in the middle of something. I've tried overriding the ShowWithoutActivation property and returning true, but the form still gets focused. My guess is that a LinkLabel control I have on the form is receiving focus, thus having the form receive focus even when the ShowWithoutActivation property has returned true. How can I deactivate the form? Thanks in advance, Shy.

    P I S 3 Replies Last reply
    0
    • S Shy Agam

      Hello experts, An application I'm currently developing pops-up reminder windows. Being a popup window, it should not "steal" the focus, as it can be unpleasent to the user if he's in the middle of something. I've tried overriding the ShowWithoutActivation property and returning true, but the form still gets focused. My guess is that a LinkLabel control I have on the form is receiving focus, thus having the form receive focus even when the ShowWithoutActivation property has returned true. How can I deactivate the form? Thanks in advance, Shy.

      P Offline
      P Offline
      Paul Conrad
      wrote on last edited by
      #2

      Have you tried just using the Hide method?

      "The clue train passed his station without stopping." - John Simmons / outlaw programmer

      S 1 Reply Last reply
      0
      • S Shy Agam

        Hello experts, An application I'm currently developing pops-up reminder windows. Being a popup window, it should not "steal" the focus, as it can be unpleasent to the user if he's in the middle of something. I've tried overriding the ShowWithoutActivation property and returning true, but the form still gets focused. My guess is that a LinkLabel control I have on the form is receiving focus, thus having the form receive focus even when the ShowWithoutActivation property has returned true. How can I deactivate the form? Thanks in advance, Shy.

        I Offline
        I Offline
        il_masacratore
        wrote on last edited by
        #3

        Maybe you're using ShowDialog instead of simply show...

        S I 2 Replies Last reply
        0
        • I il_masacratore

          Maybe you're using ShowDialog instead of simply show...

          S Offline
          S Offline
          Shy Agam
          wrote on last edited by
          #4

          Correct. I did use ShowDialog(). However, even using Show() it still steals the focus.

          1 Reply Last reply
          0
          • P Paul Conrad

            Have you tried just using the Hide method?

            "The clue train passed his station without stopping." - John Simmons / outlaw programmer

            S Offline
            S Offline
            Shy Agam
            wrote on last edited by
            #5

            I don't want to hide the form... I want it to appear on top, but not to steal focus.

            1 Reply Last reply
            0
            • S Shy Agam

              Hello experts, An application I'm currently developing pops-up reminder windows. Being a popup window, it should not "steal" the focus, as it can be unpleasent to the user if he's in the middle of something. I've tried overriding the ShowWithoutActivation property and returning true, but the form still gets focused. My guess is that a LinkLabel control I have on the form is receiving focus, thus having the form receive focus even when the ShowWithoutActivation property has returned true. How can I deactivate the form? Thanks in advance, Shy.

              S Offline
              S Offline
              Shy Agam
              wrote on last edited by
              #6

              Problem solved! It appears that because I set TopMost to true, the ShowWithoutActivation property became useless. When I used the TopLevel property instead, it worked. Regards, Shy.

              P 1 Reply Last reply
              0
              • I il_masacratore

                Maybe you're using ShowDialog instead of simply show...

                I Offline
                I Offline
                il_masacratore
                wrote on last edited by
                #7

                Ok. Why you don't try to pass the parent form to the constructor of the new modal form and then call the Activate method when the new form is shown? An alternative is when you call show, a line below return the focus to any control of the form. If the previous alternative don't like you try to save the ActiveControl before open in a var and after open the new form, in the Show next line call var.Focus(). Try any of this three alternative.

                1 Reply Last reply
                0
                • S Shy Agam

                  Problem solved! It appears that because I set TopMost to true, the ShowWithoutActivation property became useless. When I used the TopLevel property instead, it worked. Regards, Shy.

                  P Offline
                  P Offline
                  Paul Conrad
                  wrote on last edited by
                  #8

                  Good for you. I was going to mention the setting of TopMost, but you figured it out before I got up this morning :)

                  "The clue train passed his station without stopping." - John Simmons / outlaw programmer

                  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