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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Capturing TAB event of a button Button

Capturing TAB event of a button Button

Scheduled Pinned Locked Moved C#
questionhelp
13 Posts 5 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.
  • K Kais4U

    Hi All, I have a button on my form. When the button is selected and TAB is hit, am not able to capture this event. How can I capture the tab event on a button? Its urgent, anykind of help is highly appreciated . Thanks in advance Regards Kais

    N Offline
    N Offline
    Navi15
    wrote on last edited by
    #2

    Check out this link http://www.wdvl.com/Authoring/Scripting/Tutorial/java\_event\_others.html Hope it will help u Navi

    K 1 Reply Last reply
    0
    • K Kais4U

      Hi All, I have a button on my form. When the button is selected and TAB is hit, am not able to capture this event. How can I capture the tab event on a button? Its urgent, anykind of help is highly appreciated . Thanks in advance Regards Kais

      A Offline
      A Offline
      Andrei Ungureanu
      wrote on last edited by
      #3

      Hi, The only way I could capture the TAB key was on the KeyUp event

      Do your best to be the best

      K 1 Reply Last reply
      0
      • N Navi15

        Check out this link http://www.wdvl.com/Authoring/Scripting/Tutorial/java\_event\_others.html Hope it will help u Navi

        K Offline
        K Offline
        Kais4U
        wrote on last edited by
        #4

        Thanks Navi, The link you provided holds good for JAVA but not for C#. Let me know if you can help me out in C#. Regards Kais

        1 Reply Last reply
        0
        • A Andrei Ungureanu

          Hi, The only way I could capture the TAB key was on the KeyUp event

          Do your best to be the best

          K Offline
          K Offline
          Kais4U
          wrote on last edited by
          #5

          The keyup event does not get fired if you select the button and hit tab. The only event gets fired is the leave event.

          1 Reply Last reply
          0
          • K Kais4U

            Hi All, I have a button on my form. When the button is selected and TAB is hit, am not able to capture this event. How can I capture the tab event on a button? Its urgent, anykind of help is highly appreciated . Thanks in advance Regards Kais

            N Offline
            N Offline
            Nader Elshehabi
            wrote on last edited by
            #6

            Hello The best thing to do, I believe, would be to handle the LostFocus event. It will be fired when the button loses focus whether by the tab key or the mouse. Isn't this what you want? If not, please give more details.

            Regards:rose:

            K 1 Reply Last reply
            0
            • N Nader Elshehabi

              Hello The best thing to do, I believe, would be to handle the LostFocus event. It will be fired when the button loses focus whether by the tab key or the mouse. Isn't this what you want? If not, please give more details.

              Regards:rose:

              K Offline
              K Offline
              Kais4U
              wrote on last edited by
              #7

              Hi, Thank you for your quick response. As you mention, the lost focus (Leave event for the button) will get fired for both key board and mouse movements. I explicitly need to capture Tab event generated on the button so that I can set the focus to some other control on the form. The reason is, Am using MDI form and displays two child windows side by side. On the first child window, when the focus is on the last control and the user clicks on TAB, the focus should go to the first control of second child window. Hope things are clear and you might be in able to help me out. Thanks Regards Kais

              N 1 Reply Last reply
              0
              • K Kais4U

                Hi All, I have a button on my form. When the button is selected and TAB is hit, am not able to capture this event. How can I capture the tab event on a button? Its urgent, anykind of help is highly appreciated . Thanks in advance Regards Kais

                M Offline
                M Offline
                Martin 0
                wrote on last edited by
                #8

                Hello, Do you whant to navigate with the Tab Key?

                K 1 Reply Last reply
                0
                • M Martin 0

                  Hello, Do you whant to navigate with the Tab Key?

                  K Offline
                  K Offline
                  Kais4U
                  wrote on last edited by
                  #9

                  Yes, I need to navigation on the screen thru TAB. Actually, Its MDI form and has two child windows displays side by side. On the first child window, when the focus is on the last control and the user hits TAB, the focus should go to the first control of the second child form. Thanks in advace for all your suggestion/help Regards, Kais

                  M 1 Reply Last reply
                  0
                  • K Kais4U

                    Yes, I need to navigation on the screen thru TAB. Actually, Its MDI form and has two child windows displays side by side. On the first child window, when the focus is on the last control and the user hits TAB, the focus should go to the first control of the second child form. Thanks in advace for all your suggestion/help Regards, Kais

                    M Offline
                    M Offline
                    Martin 0
                    wrote on last edited by
                    #10

                    Hello, I think it's best to watch lostfocus event of the last control. Then you can set Focus on the first Focus of the child Form. Hope that helps you! All the best, Martin

                    K 1 Reply Last reply
                    0
                    • M Martin 0

                      Hello, I think it's best to watch lostfocus event of the last control. Then you can set Focus on the first Focus of the child Form. Hope that helps you! All the best, Martin

                      K Offline
                      K Offline
                      Kais4U
                      wrote on last edited by
                      #11

                      Hi Martin, Lost focus can happen even when the user select someother control via mouse. I need to implement TAB navigation. I cannot do this using Lost Control event. Let me know if there is any other alternative. Regards, Kais

                      1 Reply Last reply
                      0
                      • K Kais4U

                        Hi, Thank you for your quick response. As you mention, the lost focus (Leave event for the button) will get fired for both key board and mouse movements. I explicitly need to capture Tab event generated on the button so that I can set the focus to some other control on the form. The reason is, Am using MDI form and displays two child windows side by side. On the first child window, when the focus is on the last control and the user clicks on TAB, the focus should go to the first control of second child window. Hope things are clear and you might be in able to help me out. Thanks Regards Kais

                        N Offline
                        N Offline
                        Nader Elshehabi
                        wrote on last edited by
                        #12

                        Hello If you are using .Net 2.0 framework, handle the PreviewKeyDown event

                        private void MyButton_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
                        {
                        if (e.KeyData == Keys.Tab)
                        MessageBox.Show("Tab");//Your code goes here!!
                        }

                        I hope this helps:)

                        Regards:rose:

                        M 1 Reply Last reply
                        0
                        • N Nader Elshehabi

                          Hello If you are using .Net 2.0 framework, handle the PreviewKeyDown event

                          private void MyButton_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
                          {
                          if (e.KeyData == Keys.Tab)
                          MessageBox.Show("Tab");//Your code goes here!!
                          }

                          I hope this helps:)

                          Regards:rose:

                          M Offline
                          M Offline
                          Martin 0
                          wrote on last edited by
                          #13

                          I think I have to change to .Net 2.0. Thats a great Event. Thanks for that post. Martin

                          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