Questions tagged [keyevent]

An event that is triggered when a key is pressed,released or remains pressed on a keyboard input device.

A KeyEvent is an event that is triggered when a key is pressed, released or remains pressed on a keyboard input device. The event can contain:

  • info about particular key that was pressed/released
  • how long the key was pressed
  • whether any modifier keys were also pressed (such as Ctrl or Alt).
  • type of event - press, release, other (for example character was typed, regardless whether key was pressed or released)

Some platforms/keyboards may generate auto-repeat key events - same character is typed repeatedly while key remain pressed

1258 questions
6
votes
4 answers

submit a query when click on search button in keyboard

I have search view in my fragment. when I click on it , keyboard is open and I can type text. I want when I click on search button in keyboard , my query send to my server and get result but I don't know how get search event. any solution?
Saber Solooki
  • 1,182
  • 1
  • 15
  • 34
6
votes
1 answer

Custom Key Events

How can I send a custom SWT key event such that it results in the typing of that exact literal character without any conversion? We are making a custom on-screen graphical keyboard that allows for multiple possible layouts - QWERTY being the main…
Southpaw Hare
  • 1,535
  • 3
  • 24
  • 50
6
votes
2 answers

How to catch Control-V in C# app?

I've tried to override WndProc, but no message show up on paste event. Then I tried to create custom filter and using method PreFilterMessage I was able to catch message with value 257 (KEYUP event), but that's not enough...
Goran
6
votes
1 answer

Permission: INJECT_EVENTS for Instrumenation to other apps

I know that this is not the first Thread about this permission, however the other ones aren't finished or don't help me. What I need is to inflate KeyEvents using Instrumentation. That works great and is insanely faster than the shell ("input…
paulgavrikov
  • 1,883
  • 3
  • 29
  • 51
6
votes
1 answer

Android - Listener for hard keys press at background

Android provides some callback methods which help our to handle key event inside the apps. But what if I want to listen key events when my app is running at background? Eg. I want to listen for long press event on search button to do a special…
Nguyen Minh Binh
  • 23,891
  • 30
  • 115
  • 165
6
votes
2 answers

Can I simulate game pad button presses with Java's Robot class (Java.awt.robot)?

I'm using an Arduino Uno to hook a (genuine) SNES controller to a computer via USB or Bluetooth. The Arduino captures the controller's button presses and releases using the snespad library. It communicates button presses and releases as characters…
keattsd
  • 69
  • 5
5
votes
6 answers

Not able to catch android back button event

I am trying to catch the back button event for Android. I know there is a lot about this already on the forms, however, my code does not work as the examples given. Here is my code snippet to capture the event: @Override public boolean onKeyDown(int…
coder
  • 10,460
  • 17
  • 72
  • 125
5
votes
2 answers

JTextField limit input to certains chars only

i'd like to create JTextField with input characters limited to someting like "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVXYWZZ0123456789+&@#/%?=~_-|!:,.;" so i tried overriding public class CustomJTextField extends JTextField { String…
UnableToLoad
  • 315
  • 6
  • 18
5
votes
1 answer

Adding a macOS app to the list of accessibility in privacy system preferences

I am working on a macOS app that is a background app and so I would like to perform a particular function when a keyboard key is pressed. I read from the apple documentation that addGlobalMonitorForEvents(matching:handler: ) must be used. And also…
MaraV932
  • 51
  • 1
5
votes
1 answer

keyevent android phone locked

I´m new to android development and I´m trying to make an app. What I want to know is if is it possible to get key events even when the phone is locked? For example to make my music player change the music when I press the DPAD_CENTER_BUTTON Doing…
Guilherme Gusman
  • 556
  • 2
  • 7
  • 17
5
votes
3 answers

How to detect character key presses?

I know how to listen for when the ENTER button is pressed in a TextView, as shown in the code below: textView.setOnKeyListener(new View.OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { …
Brian
  • 7,955
  • 16
  • 66
  • 107
5
votes
3 answers

How to dynamically assig keys to buttons?

I have a section in my GUI that is generated dynamically according to a list of objects. So, for each object in that list I want to create a JButton and associate a keyboard shortcut. For example: for (String tag : testTags) { new…
ktulinho
  • 3,870
  • 9
  • 28
  • 35
5
votes
1 answer

JavaFX KeyCombination for Command+T (New Tab)

I'm trying to make a key pressed listener for my browser app for Command+T to trigger opening a new tab in the same way that most actual browsers do it. Looked up some possible solutions for this and it looks like I probably have to use…
faris
  • 692
  • 4
  • 18
5
votes
1 answer

KeyEvent getRepeatCount() always return 0

I'm working with remote android TV To catch event when use press remote button I use this code: public boolean dispatchKeyEvent(KeyEvent event) { Log.d("LOG", "Number repeate count = " + event.getRepeatCount()); if (event.getAction()…
mdtuyen
  • 4,470
  • 5
  • 28
  • 50
5
votes
1 answer

Opera preventDefault() on keydown event

I'm trying to embed some keybindings in my webapp, and I'm having hard times with Opera. I have this code: window.onkeydown = function(e){ var key = e.keyCode ? e.keyCode : e.charCode ? e.charCode : false; if (e.ctrlKey && key === 84) { …
aL3xa
  • 35,415
  • 18
  • 79
  • 112