keyboard-events

How to detect backspace in a keyTypedEvent

爷,独闯天下 提交于 2019-12-29 08:10:02
问题 I'm using Netbeans' bean form to create my GUI. I've added a keyTyped event to a JTextArea and I want to detect if the typed key is a Backspace . I'm using keyTyped event for other reasons so I cannot just use the keyPressed event. This is the generated code (and my if check): private void langArea1KeyTyped(java.awt.event.KeyEvent evt) { if(evt.getChar()== backspace) //how can I make this check? } evt.getKeyCode() always returns 0 independent of the typed key. evt.getKeyChar() simply deletes

How to hook/remap an arbitrary keyboard event on OSX?

做~自己de王妃 提交于 2019-12-29 04:53:29
问题 I would like to map: CAPS-LOCK to Fn Fn to Left-MOUSE LSHIFT + 3 to # RSHIFT + 3 to something else etc. I have searched exhaustively for any tool that offers complete freedom for remapping keyboard input, but cannot find one. (Windows has AutoHotkey). I'm planning to write my own tool that parses a config file. But how to actually dig in and do this? Solving this problem will require a thorough understanding of the journey of a keystroke through the operating system, so as to intercept at the

Close JS Menu on ESC

99封情书 提交于 2019-12-25 18:25:37
问题 I am working on a simple slide-in menu system. I'd like to be able to close a menu by hitting the ESC key. Here's my current code: http://jsfiddle.net/3w539Lct/3/ Line 126 of my Javascript, you can see: $( document ).on( 'keydown', function ( e ) { if ( e.keyCode === 27 ) { // ESC $(".menu-wrap").prop("checked", false); } }); However, this doesn't work. Can someone help? 回答1: I reused some of your existing functions and variables. This should be correct. The element $(."menu-wrap") is a div ,

SendInput sequence to create unicode character fails

旧街凉风 提交于 2019-12-25 09:43:40
问题 I'm working with an on-screen keyboard that needs to send key strokes to a third party application. They are running on Windows XP. A small set of characters that are not available on the US English keyboard need to be supported (such as "å" or ñ). After reviewing SendInput it seemed like the safest thing would be to send the hex unicode value of the character as a key stroke sequence. I wrote code that sends an "Alt" and "Add" key down event, followed by key down and up events for the four

Use Keyboard.IsKeyDown in C# console application

梦想的初衷 提交于 2019-12-25 07:45:07
问题 I'm writing an console application witch Displaying certain data on the console screen, than checking for user input from the keyboard and finally handleing it by need. all single threaded. For that i tried using Keyboard.IsKeyDown Method from System.Windows.Input namespace. and visual studio wo'nt allow it. Does anyone knows why and can help me? I dont see other way implementing that logic using only one thread and no timer's. 回答1: Use Console.ReadKey() to read input from the keyboard in a

What am I doing wrong to adjust my view in iOS when resigning keyboards

末鹿安然 提交于 2019-12-25 04:19:40
问题 I have 6 Textfields in my viewController. 2 on the first row, 1 on the second, 1 on the third and 2 on the last row. The textfields work fine as far as typing into it. I just have issues scrolling the view up and down when the keyboard appears. The view scrolls up fine but when I "resign responder", the view scrolls down but scrolls down too much. e.g. if the view moved up by y amount, once I resign responder, the view would move down a value greater than y. I have the following code set up

how to get characters with accent from NSEvent

对着背影说爱祢 提交于 2019-12-25 03:56:24
问题 When I press ^ or ` and then a or e I get only a or e instead of â or é . This is my code: - (void) keyDown:(NSEvent*)event { NSString* str = [event characters]; } How do I solve this? 回答1: keyDown: only gives the characters for the key you currently are pressing down. Characters that take more than one keystroke show up as a separate keyDown: call for each keystroke. If you want to see typed characters instead of individual keypresses, override -insertText: instead. 来源: https://stackoverflow

qt app that takes in textedit barcode scanned, how to change focus between two fields

一笑奈何 提交于 2019-12-24 20:13:10
问题 So for me the plan is like this: I scan a barcode, it gets in first textedit; I scan another barcode, it gets in the second textedit, in this case i use focus and keyboard event. my problem is when i scan first code it is fine but when I scan the second code, some of letters go to second texedit some go to first texedit. I don't understand what is the problem here is my code void CWidget::keyPressEvent(QKeyEvent *event) { if(focusWidget() == ui->lePath && !ui->lePath->text().isEmpty()) { ui-

Popup Keyboard like Android Default keyboard

爱⌒轻易说出口 提交于 2019-12-24 15:26:58
问题 Imagine a normal keyboard in android (like English). When pressing and holding A for a while, a new menu with á, ä and other buttons popups up. And while still holding the first finger down on screen, you slide it on top of another of those buttons. As you slide it over a button, it gets into highlighted mode , and when you slide out the highlighting is turned off. If you release the finger, the popup buttons disappear. If you held the finger over one of the buttons, that button's character

How to detect Virtual Keyboard Events in Android with Delphi

落爺英雄遲暮 提交于 2019-12-24 05:38:09
问题 I'm trying to develop an Android app with Rad studio Xe5 with Delphi, and i having the following problem: There is a Tmemo, which is at the bottom of the screen, and at the time of pressing it for typing some text, the virtual keyboard is showed over the Tmemo which i can't see. I would like to detect the event on show keyboard and move change the position of that Tmemo. I will do the same when the Virtual Keyboard is hide, and bring back the Tmemo to his original position. Does anybody know