Questions tagged [keyboard]

A text input device. Use this tag to ask programming questions related to typing, keyboard hiding and more.

What topics don't belong here?

If your question is about:

  • Making a (physical) keyboard: See electronics.SX. (Of course, if you want to implement/imitate a keyboard in software — e.g. an on-screen keyboard — then go right ahead and ask.)

  • Configuring your keyboard: See superuser.com, unix.SX, or another site that covers using computer systems — Stack Overflow is about programming them.

  • Interfacing with a device resembling a piano: This is not the tag you're looking for. Move along.

12648 questions
133
votes
5 answers

How to read keyboard input?

I would like to read data from the keyboard in Python. I tried this code: nb = input('Choose a number') print('Number%s \n' % (nb)) But it doesn't work, either with eclipse nor in the terminal, it's always stop of the question. I can type a number…
tranen
  • 1,333
  • 2
  • 10
  • 6
131
votes
5 answers

Vim users, where do you rest your right hand?

Longtime vim users, do you keep your fingers onjkl; or hjkl in normal mode? Standard touch typing teaches us the home position for the right hand has the index finger on the j key, so your fingers are on jkl;. But standard vim motion keys are…
Sukotto
  • 2,472
  • 6
  • 26
  • 31
126
votes
21 answers

How can I programmatically check whether a keyboard is present in iOS app?

I need to check the condition of keyboard visibility in my iOS app. Pseudocode: if(keyboardIsPresentOnWindow) { //Do action 1 } else if (keyboardIsNotPresentOnWindow) { //Do action 2 } How can I check this condition?
Jitendra Singh
  • 2,103
  • 3
  • 17
  • 26
123
votes
14 answers

Check if a key is down?

Is there a way to detect if a key is currently down in JavaScript? I know about the "keydown" event, but that's not what I need. Some time AFTER the key is pressed, I want to be able to detect if it is still pressed down. P. S. The biggest issue…
Daniel X Moore
  • 14,637
  • 17
  • 80
  • 92
122
votes
18 answers

iPhone Keyboard Covers UITextField

I have an app where, in Interface Builder, I set up a UIView that has a text field near the bottom of the view. When I run the app and try to enter text into that field, the keyboard slides up overtop of the field so I can't see what I'm typing…
Cruinh
  • 3,611
  • 4
  • 38
  • 45
118
votes
5 answers

How can I check if a key is pressed during the click event with jQuery?

I would like to catch a click event with jQuery and be able to tell if a key was pressed at the same time so I can fork within the callback function based on the keypress event. For example: $("button").click(function() { if([KEYPRESSED WHILE…
daniel smith
  • 1,181
  • 2
  • 7
  • 3
118
votes
20 answers

How to dismiss keyboard iOS programmatically when pressing return

I created a UITextField programmatically making the UITextField a property of the viewController. I need to dismiss the keyboard with the return and the touch on the screen. I was able to get the screen touch to dismiss, but pressing return is not…
noobsmcgoobs
  • 2,716
  • 5
  • 32
  • 52
115
votes
31 answers

Not able to type in textfield in iphone simulator using Mac Keyboard?

I'm working on a basic iOS app which supports both portrait and landscape modes. When the iPhone simulator keyboard is open in landscape and I'm switching the app to portrait mode I'm unable to type anything in any text field using my Mac physical…
Deepak Carpenter
  • 1,504
  • 2
  • 10
  • 21
111
votes
4 answers

How to develop a soft keyboard for Android?

I would like to play around with some ideas and develop a soft keyboard for Android to replace the default one. Is there any general information about soft keyboard development for Android out there? Any best practices or guidelines? Can I do with…
znq
  • 44,613
  • 41
  • 116
  • 144
111
votes
9 answers

How to remove auto focus/keyboard popup of a field when the screen shows up?

I have a screen where the first field is an EditText, and it gains the focus at startup, also popups the numeric input type, which is very annoying How can I make sure that when the activity is started the focus is not gained, and/or the input panel…
Pentium10
  • 204,586
  • 122
  • 423
  • 502
110
votes
8 answers

How to force keyboard with numbers in mobile website in Android

I have a mobile website and it has some HTML input elements in it, like this: I have embedded the site into a WebView for possible Android 2.1 consumption, so that it will also be an Android…
ncakmak
  • 4,014
  • 5
  • 20
  • 17
106
votes
6 answers

How do I detect keypresses in Javascript?

After looking around on the internet, I've seen a lot of suggestions (use window.onkeypress, use jQuery, etc.) but for almost every option there's a counterargument. How can I detect a keypress in Javascript?
bobismijnnaam
  • 1,361
  • 2
  • 10
  • 20
101
votes
8 answers

Use "ENTER" key on softkeyboard instead of clicking button

Hello I've got a searched EditText and search Button. When I type the searched text, I'd like to use ENTER key on softkeyboard instead of search Button to activate search function. Thanks for help in advance.
peter.o
  • 3,460
  • 7
  • 51
  • 77
100
votes
20 answers

Automatic popping up keyboard on start Activity

I got a relative simple question. I have an activity with a lot of EditText's in them. When I open the activity it automatically focusses to the first EditText and displays the virtual keyboard. How can I prevent this?
Galip
  • 5,435
  • 10
  • 37
  • 47
100
votes
8 answers

Where can I find a list of Mac virtual key codes?

I'm using CGEventCreateKeyboardEvent and need to know what CGKeyCode values to use. Specifically, I am after the key code for the Command key. The docs give examples for other keys: z is 6, shift is 56. There must be a list of Mac virtual keycodes…
Nick Moore
  • 15,547
  • 6
  • 61
  • 83