keyevent

disable copy and paste in datagridview

久未见 提交于 2019-12-04 17:32:34
I am a beginner in .net. This could be a silly question. I want to disable ctrl + c and ctrl + v keyboard shortcuts. Before asking here I tried these codes link1 and link2 ( not working ) private void dgvMain_CellEndEdit(object sender, DataGridViewCellEventArgs e) { this.dgvMain.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableWithoutHeaderText; } private void dgvMain_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { this.dgvMain.ClipboardCopyMode = DataGridViewClipboardCopyMode.Disable; } and also this.dgvMain.ClipboardCopyMode = DataGridViewClipboardCopyMode.Disable;

How to move a Bug in GridWorld with arrow keys

荒凉一梦 提交于 2019-12-04 17:20:00
I'm making a game for my computer Science class and I am trying to move a character object that extends Bug with the arrow keys. Should I put the code to move with the arrow keys in the Character class or in the World class? And what should the code look like? Right now I've got this code in the Character class and it complies fine, but when I try to to run it in the grid nothing happens when I press the arrow keys. public class Character extends Bug { Random pokemon; public Character() { } public void act(KeyEvent e) { move(e); pokemon = new Random(); if(pokemon.nextInt(10) == 5) System.out

Permission: INJECT_EVENTS for Instrumenation to other apps

断了今生、忘了曾经 提交于 2019-12-04 12:11:42
问题 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 keyevent ") method. But if I want to inject to other apps I catch a SecurityException. That didn't surprise me to much so I added <uses-permission android:name="android.permission.INJECT_EVENTS" /> to my manifest. Eclipse stops to debug this telling me

How to get keyCodes from Android mobile device keyboard?

倖福魔咒の 提交于 2019-12-04 11:45:23
问题 Currently, I am facing a problem on a mobile device. I have an input field where only some keys are allowed to be pressed: e.g. only the numbers 0–9. It works fantastic on a web browser. But when I open it in my Android mobile device it fails. I have used keyup and keypress . keyup is working but I want to know which key fired the event from the mobile keyboard. How would I get that? 回答1: I'm using a array that has maping to all keyboard keys with keycode at given index and then on element's

JavaFX TextField : Automatically transform text to uppercase

梦想与她 提交于 2019-12-04 11:33:06
问题 I have a JavaFX TextField control on my FXMl that looks like this... <TextField fx:id="input_search" onKeyPressed="#keyListener" prefHeight="25.0" prefWidth="197.0" /> I want to automatically change all characters to uppercase when the user is typing. The code in my controller : public void keyListener(KeyEvent event){ //maybe transform the pressed key to uppercase here... } 回答1: There are a few ways to achieve this: Override replaceText() TextField textField = new TextField() { @Override

onKeyEvent & Accessibility Service

前提是你 提交于 2019-12-04 05:32:28
My users will be using TalkBack enabled or some other Accessible Service. I would like to capture the onKeyEvent events in our App but the event is dispatched to the enabled Accessibility Services. I have created the following basic Accessibility Service. public class Accessibility_Service extends AccessibilityService { private String TAG = Accessibility_Service.class.getSimpleName(); @Override public boolean onKeyEvent(KeyEvent event) { int action = event.getAction(); int keyCode = event.getKeyCode(); if (action == KeyEvent.ACTION_UP) { if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) { Log.d(

What triggers (or generates) KeyEvent.ACTION_MULTIPLE?

邮差的信 提交于 2019-12-03 11:07:13
The documentation for KeyEvent.ACTION_MULTIPLE says: "multiple duplicate key events have occurred in a row, or a complex string is being delivered. If the key code is not {#link KEYCODE_UNKNOWN then the {#link getRepeatCount() method returns the number of times the given key code should be executed. Otherwise, if the key code is KEYCODE_UNKNOWN, then this is a sequence of characters as returned by getCharacters()." But it doesn't say how to actually generate that event. I tried (rapidly) double-clicking the headset's Pause/Play button, but all I receive is ordinary ACTION_UP and ACTION_DOWN. I

can't fire keypress event when press delete key

牧云@^-^@ 提交于 2019-12-03 10:35:12
I'm finding that the delete key doesn't fire the keypress event in Chrome, while other keys work. The problem doesn't occur in Firefox, just in chrome, why? Here is my code: document.addEventListener('keypress', function (e) { console.log(e); }, false); Use keydown or keyup instead, it captures the delete key (as well as others that keypress doesn't, see http://www.quirksmode.org/js/keys.html ) document.addEventListener('keydown', function (e) { console.log(e); }, false); keypress event for (Del, End, Home,etc..) is not fired in IE, Chrome and safari .. it only works in firefox. . so you can

JavaFX TextField : Automatically transform text to uppercase

泄露秘密 提交于 2019-12-03 07:27:36
I have a JavaFX TextField control on my FXMl that looks like this... <TextField fx:id="input_search" onKeyPressed="#keyListener" prefHeight="25.0" prefWidth="197.0" /> I want to automatically change all characters to uppercase when the user is typing. The code in my controller : public void keyListener(KeyEvent event){ //maybe transform the pressed key to uppercase here... } There are a few ways to achieve this: Override replaceText() TextField textField = new TextField() { @Override public void replaceText(int start, int end, String text) { super.replaceText(start, end, text.toUpperCase()); }

How to get keyCodes from Android mobile device keyboard?

落花浮王杯 提交于 2019-12-03 07:18:23
Currently, I am facing a problem on a mobile device. I have an input field where only some keys are allowed to be pressed: e.g. only the numbers 0–9. It works fantastic on a web browser. But when I open it in my Android mobile device it fails. I have used keyup and keypress . keyup is working but I want to know which key fired the event from the mobile keyboard. How would I get that? I'm using a array that has maping to all keyboard keys with keycode at given index and then on element's keydown i'm checking whether its allowed key or not, because in mobile some keyboard key will have the same