keyevent

Difference between C++ Keyboard keycode and JAVA KeyEvent keycode

I noticed a difference between the keycodes that vkCode in C++ gives and the ones that Java's KeyEvent gives us. (Ofcourse the normal characters have the same code (0 => 48 just like the ASCII) but they differ in the other keys). Is there a way to 'translate' them from one to the other (What's the logic behind each one?) or am I supposed...

Android Send Key Event When Calling

I have an app through which I can make a call to a number. What I want is to send Number ( 0-9 ) to receiver when talking. Can any one help me? ...

How do you send a long press from an InstrumentationTestCase?

In Android, how can I send a long press from an InstrumentationTestCase? I'd like for instance to do a sendKeys(KEYCODE_DPAD_CENTER) but make that a long click. ...

How to listen to keyboard events in GWT table?

In my GWT program I have a table that has a selected row. I'd like to move the row selection with the up- and down-keys on the keyboard. So I have to catch the key events somehow. The GWT docs handle key events in input fields only. But I don't have an input field! Is this possible at all? Maybe it is a DOM/Javascript restriction that ...

Is it possible to create an Android Service that listens for hardware key presses?

I'd like to run an Android background service that will act as a keylistener from the home screen or when the phone is asleep. Is this possible? From semi-related examples online, I put together the following service, but get the error, "onKeyDown is undefined for the type Service". Does this mean it can't be done without rewriting La...

Disabling Alt-F4 on a Win Forms NotifyIcon

I am using a NotifyIcon from Win Forms to make a systray icon for my WPF C# application. I have a bug where if the user right clicks the icon for the context menu, they can press Alt-F4 and the icon will disappear from the tray, but the Main WPF application is still running. This is especially a problem when they have "minimized to syst...

Responding to key events in scala

Hi chaps, I'm experimenting with a bit of Scala gui programming (my first project in scala, so I thought I'd start with something simple). But I seem to have got stuck at something that seems like it should be relatively trivial. I have a class that extends scala.swing.MainFrame, and I'd like to detect when a user presses a key when that...

How to intercept a hard key pressed in a service?

Is there anyway to intercept that a hard key was pressed by using a service in order to launch an activity? In other words : Is it possible to handle the KeyEvents in the Service? ...

Simulating keypresses in Visual C++

Ok so I might be totally barking up the wrong tree here as I'm not that up to date on Windows programming but here goes. I'm trying to initiate a simulated keypress in a C++ project in Visual Studio 2010. Essentially when the program receives a specific code string from another application (which is all being worked via many if stateme...

Right way to make controller react on space key event

Im making an application where i got a cue list, and some other views around it. When the user presses Space, i want the next cue to play. No matter what view is first responder, unless its a textfield. So even though another table is selected, i want the cue to get played. I have made a custom class that acts as cue controller, this i...

How to use ADB to send touch events to device using sendevent command?

Hi I am trying to send touch events to a device using AndroidDebugBridge, so that I can do some basic automation for UI tests. I have followed the discussion in LINK. I am able to use sendevent to simulate touch on emulators, but unable to do the same on a device. Like in above link the emulator seems to send out 6 events for each tou...

Android: Help creating a button that produces the same result as hitting the down key on the D-Pad? (part 2)

Why doesn't this work?? I am trying to create an onClickListener for a button that produces the same effect as pressing the "down" key on the D-pad. Eclipse gives me an error, saying: "Cannot make a static reference to the non-static method sendDownUpKeyEvents(int) from the type InputMethodService" Help! downButton.setOnClickListener(ne...

Key Events in Java - Beginner Help

So I've been working on a simple program while learning Java that brings up a small rectangular screen that has a circle moving around on it. The background and circle also change colors and speeds. Now I'm trying to add KeyEvents, such that when the user types a character, the circle will change directions. I've been trying to get a ha...

Confused about Android key event handling. Any good explanations?

I'm a relative beginner with Android. Does anybody have a sane explanation for how to listen for keys and soft keys in an EditText/TextView? I'd love to see a comprehensive tutorial or set of examples. As I understand it, I can add a KeyListener to my Activity, e.g. onKeyDown(), onKeyUp() but when I try this I can't trigger the events ...

How to enable ESC-Close for an JPopupMenu, if the underlying window closes on ESC?

Imagine two common situations combined: A JDialog(or JFrame) which closes on VK_ESCAPE (set as key binding on the root pane) and an inner JPopupMenu which is supposed to close on ESC as well. The problem is: pressing escape always closes the dialog - event if the popup is visible. Apparently the popup doesn't even receive the key event s...

I can't get KeyEvent listener to work

Ok, first off. If I do System.out.println(e); that does print when I push the key. However I can not for the life of me figure out how to store this into an int. My IDE gives me no errors if I do int pressed = e.KEY_PRESSED(); or int pressed = e.getKeyCode(); but if I try to print pressed nothing happens. I've been trying to get this t...

How does Java dispatch KeyEvents?

I've read the definite tutorial on key bindings a few times, but my brain cache doesn't seem large enough to hold the complicated processes. I was debugging a key binding problem (turned out I was using the wrong JComponent.WHEN_* condition), and I stumbled upon a concise and hilarious javadoc for the package private javax.swing.Keyboar...

How is document.createEvent supposed to work with key events?

I'am trying to simulate keypresses in a web application, it is for an embedded system but it uses a Webkit derived browser. I have tested the code in Chrome and get the same error. I tried to use code snippets from this example from Yahoo, but I keep getting the same error when firing the event using dispatchEvent. "target" is an HTML e...

I want to play any Flash game on Android (as .swf file). How can I pass key events to a SWF app?

Hi stackoverflow. Can you help me play Robot Unicorn Attack on my Android phone? I downloaded the .swf file, put it on my phone and there is this app called SWF Player that can open SWF files from the SDCard. But, since I don't have a hardware keyboard, I can't play the game because I have no chance pressing X or Z (I heard even with a...

Android - Listen for key presses on Numeric keypad?

I use the following code to listen for the key presses of 0 - 9 from the soft input keyboard on Android: @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if(keyCode == KeyEvent.KEYCODE_0) { return super.onKeyDown(keyCode, event); } if(keyCode =...