Main Site Documentation

Capturing shift-tab


#1

Using the usb kybd…

I know I can detect Tab using (checking for) the representation \t …it works fine

How can shift-tab or CTRL-tab be detected?


#2

follow the key up and key down events. shift and control are keys.


#3

I am following the keyboard event…when I detect “\t” I know its a Tab & & “\b” is backspace…they work fine.

What should I use to detect a shift-TAB?


#4

you have to follow the key up and down events as I said. When you get a key down event you need to see if it is the shift key. If it is, set a variable to true. When then you get a key up event, for the shift key, set the shift variable to false. Then when you get the tab, you can check the shift variables and see if you have shift-tab.


#5

When you detect tab key,call GetKeyStatemethod and pass the value for required shift or control key to check if it is down as well.

http://www.ghielectronics.com/downloads/NETMF/Library%20Documentation/html/2002e080-1826-5606-e462-04b7fc58bc10.htm


#6

Thanks…worked like a champ

static void CharDown(USBH_Keyboard sender, USBH_KeyboardEventArgs args)
        {
            USBH_Keyboard ddd = (USBH_Keyboard)sender;
            bool shiftPressed = ddd.GetKeyState(USBH_Key.LeftShift) == USBH_KeyState.Down;
            shiftPressed |= ddd.GetKeyState(USBH_Key.RightShift) == USBH_KeyState.Down;  //either shift key sets true condition
            
            nuchar = args.KeyAscii.ToString();

            getintkybdval(nuchar,shiftPressed);
                  
        }