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 / C++ / MFC
  4. Shift + VK_LEFT

Shift + VK_LEFT

Scheduled Pinned Locked Moved C / C++ / MFC
debugginghelpquestion
15 Posts 3 Posters 1 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.
  • J Jochen Arndt

    It should work that way. But it will not work if those key combinations are "eaten" by an existing pre-translation. You may test that by using the first version with an extended trace:

    TRACE1(">>>%d, state %x", nChar, GetKeyState(VK_SHIFT));

    If the above is not called with shift key down, it is probably "eaten". Then you must use PreTranslateMessage or try to disable the existing translation.

    _ Offline
    _ Offline
    _Flaviu
    wrote on last edited by
    #5

    Strange ... I have checked if parent of CGridCtrlExt (CGridCtrl), has PreTranslateMessage, but no, has not ... more over, I override CGridCtrlExt::OnChar, CGridCtrlExt::OnSysChar, CGridCtrlExt::OnSysKeyDown, none of them tell me when I press the shift key ... weird ... I don't know where to search the issue ...

    J 1 Reply Last reply
    0
    • _ _Flaviu

      Strange ... I have checked if parent of CGridCtrlExt (CGridCtrl), has PreTranslateMessage, but no, has not ... more over, I override CGridCtrlExt::OnChar, CGridCtrlExt::OnSysChar, CGridCtrlExt::OnSysKeyDown, none of them tell me when I press the shift key ... weird ... I don't know where to search the issue ...

      J Offline
      J Offline
      Jochen Arndt
      wrote on last edited by
      #6

      I don't know which CGridCtrl you are using. The keys may be also catched by an underlying Windows control so that you don't see the translator source. If there is some action associated, you should recognize it. What happens when pressing Shift Left/Right on a wide item? You may spend some more time for investigation or just implement your own PreTranslateMessage handler.

      _ 1 Reply Last reply
      0
      • L Lost User

        I have just tried this and it all works as per the documentation. I can only assume that these keys are being trapped by the CGridCtrlExt control somehow.

        _ Offline
        _ Offline
        _Flaviu
        wrote on last edited by
        #7

        Neither CGridCtrlExt has PreTranslateMessage, or something that could trap the shift key ... I can not understand what happen ...

        L 1 Reply Last reply
        0
        • J Jochen Arndt

          I don't know which CGridCtrl you are using. The keys may be also catched by an underlying Windows control so that you don't see the translator source. If there is some action associated, you should recognize it. What happens when pressing Shift Left/Right on a wide item? You may spend some more time for investigation or just implement your own PreTranslateMessage handler.

          _ Offline
          _ Offline
          _Flaviu
          wrote on last edited by
          #8

          "I don't know which CGridCtrl you are using" I am using this[^] one.

          J 1 Reply Last reply
          0
          • _ _Flaviu

            Neither CGridCtrlExt has PreTranslateMessage, or something that could trap the shift key ... I can not understand what happen ...

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #9

            Do you have the source of that class to check? The only real answer is to use your debugger and inspect all the values that are set when the key combination is pressed.

            _ 1 Reply Last reply
            0
            • _ _Flaviu

              "I don't know which CGridCtrl you are using" I am using this[^] one.

              J Offline
              J Offline
              Jochen Arndt
              wrote on last edited by
              #10

              I have not used that so far. But I'm quite sure that the arrow keys are used to select cells when the Shift key is pressed too.

              1 Reply Last reply
              0
              • J Jochen Arndt

                It should work that way. But it will not work if those key combinations are "eaten" by an existing pre-translation. You may test that by using the first version with an extended trace:

                TRACE1(">>>%d, state %x", nChar, GetKeyState(VK_SHIFT));

                If the above is not called with shift key down, it is probably "eaten". Then you must use PreTranslateMessage or try to disable the existing translation.

                _ Offline
                _ Offline
                _Flaviu
                wrote on last edited by
                #11

                I guess it is my mistake !!! : I already have an accelerator, shift + left key, on menu item command ... if this is the cause, is there any possibility to know in CGridCtrlExt, of on CDialog which contain this control, to know when I pressed Shift and left key ?

                J 1 Reply Last reply
                0
                • L Lost User

                  Do you have the source of that class to check? The only real answer is to use your debugger and inspect all the values that are set when the key combination is pressed.

                  _ Offline
                  _ Offline
                  _Flaviu
                  wrote on last edited by
                  #12

                  I think I found the problem: [^].

                  1 Reply Last reply
                  0
                  • _ _Flaviu

                    I guess it is my mistake !!! : I already have an accelerator, shift + left key, on menu item command ... if this is the cause, is there any possibility to know in CGridCtrlExt, of on CDialog which contain this control, to know when I pressed Shift and left key ?

                    J Offline
                    J Offline
                    Jochen Arndt
                    wrote on last edited by
                    #13

                    If you have a global accelerator you have three options:

                    1. From the accelerator handling check if your grid control is active and pass the message to that if so
                    2. Add another accelerator table to your grid control
                    3. Use PreTranslateMessage in your grid control
                    _ 2 Replies Last reply
                    0
                    • J Jochen Arndt

                      If you have a global accelerator you have three options:

                      1. From the accelerator handling check if your grid control is active and pass the message to that if so
                      2. Add another accelerator table to your grid control
                      3. Use PreTranslateMessage in your grid control
                      _ Offline
                      _ Offline
                      _Flaviu
                      wrote on last edited by
                      #14

                      I will try your first solution. I'll come back.

                      1 Reply Last reply
                      0
                      • J Jochen Arndt

                        If you have a global accelerator you have three options:

                        1. From the accelerator handling check if your grid control is active and pass the message to that if so
                        2. Add another accelerator table to your grid control
                        3. Use PreTranslateMessage in your grid control
                        _ Offline
                        _ Offline
                        _Flaviu
                        wrote on last edited by
                        #15

                        Because left/right key combined with shift/ctrl key are used to mark grid cells, I have chose to use F7/F8 key for my needs. Thank you all of you for patience and attention. Bye.

                        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