keyboard-events

Disable the Ctrl-Alt-Delete event through Java program

被刻印的时光 ゝ 提交于 2019-12-19 19:54:31
问题 I am creating a desktop application using the JDesktopPane. I'm almost complete, but when I press ctrl + alt + del , it leaves my application. How can I prevent that action? 回答1: Fact is Alt + Ctrl + Del never actually entering your application. Os traps Alt + Ctrl + Del before it is send to your application. So you can't trap it. 回答2: Alt + Ctrl + Del cannot be overridden. It is a security feature. 回答3: You cannot do that. The behavior of Alt + Ctrl + Del is enforced by the operating system,

Keyboard events for child elements in a contenteditable div?

冷暖自知 提交于 2019-12-19 19:53:26
问题 I have a div who's contenteditable property has been set to true.How do I get the children to respond to keyboard events? Seems like the only way is to capture the events in the parent div and figure out the child via the selection apis. Is there a better way? More specifically, can I attach a keyboard event handler to child elements? Am I missing something? Attached is sample code that illustrates the problem. Hope the in-code comments are sufficiently explanatory. <HTML> <HEAD> <TITLE><

Windows phone keyboard open events and properties

烈酒焚心 提交于 2019-12-19 10:44:24
问题 On my Windows Phone app I need to change my view accordingly to my keyboard. I have several questions: How can I identify that the keyboard is opened? Is there an event on view for keyboard opening? Is there a way to get the height of the keyboard? Or the area size of the blocked UI (by keyboard)? 回答1: You can access to keyboard information by Windows.UI.ViewManagement.InputPane class. There is static method GetForCurrentView() . It returns InputPane for current view. InputPane has events

How to use CGEventCreateKeyboardEvent in Python on Mac?

巧了我就是萌 提交于 2019-12-19 09:49:06
问题 I have installed the pyobjc (with it Quartz), and I would like to know how one would properly create a keyboard event with CGEventCreateKeyboardEvent? Please? I can not find it at all on the internet, and plus I even have no idea what to import. An example code would be nice, telling me what to import and what to put into python Does anyone know the required code for the FN (FUNCTION KEY) in mac for CGEventCreateKeyboardEvent?? 回答1: evt = Quartz.CGEventCreateKeyboardEvent(None, vkey, True)

Keyboard shortcuts and action listeners

拈花ヽ惹草 提交于 2019-12-19 09:03:30
问题 Wondering how to link a keyboard key to a JButton in netbeans, Downloaded KeyEventDemo program from oracle that lets you press a key and it tells you the keycode, Now im wondering how to implement that, working on a calculator project and I already have the ability to click on any button and have it either + , - , / , * or enter so now I am wondering how to link the 2 together, essentially I'm trying to figure out how to check which key is being pressed in a method, and then run a method

Distinguish between normal “ENTER” and the number-pad “ENTER” keypress?

别说谁变了你拦得住时间么 提交于 2019-12-19 07:49:22
问题 In my PreviewKeyDown() handler how do I tell the difference between the ENTER key on number-pad and the ENTER key on the main board? Both keys return the same value Key.Enter for KeyEventArgs.Key . The closest answer I can find to this question is here: What's the difference between Key.Enter and Key.Return?, but unfortunately this works only if the app is fully trusted. I'd like a solution without this restriction. 回答1: See link, example impl. below. private static bool IsNumpadEnterKey

Distinguish between normal “ENTER” and the number-pad “ENTER” keypress?

孤街醉人 提交于 2019-12-19 07:49:04
问题 In my PreviewKeyDown() handler how do I tell the difference between the ENTER key on number-pad and the ENTER key on the main board? Both keys return the same value Key.Enter for KeyEventArgs.Key . The closest answer I can find to this question is here: What's the difference between Key.Enter and Key.Return?, but unfortunately this works only if the app is fully trusted. I'd like a solution without this restriction. 回答1: See link, example impl. below. private static bool IsNumpadEnterKey

Cannot listen to KeyEvent in JavaFX

爷,独闯天下 提交于 2019-12-18 16:08:46
问题 I want my JavaFX program to respond to keyboard events. I tried adding listeners to root Pane , to topmost Pane , but it doesn't respond to events! Here is my code: AnchorPane root = new AnchorPane(); root.setOnKeyPressed(new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent t) { pressKey(t.getCharacter().charAt(0)); } }); root.setOnKeyReleased(new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent t) { releaseKey(t.getCharacter().charAt(0)); } }); root

How to handle arrow key event in Cocoa app?

独自空忆成欢 提交于 2019-12-18 14:54:37
问题 How to handle arrow key event in Cocoa app? 回答1: But, but, but...I don't wanna be an NSResponder subclass. @interface AMonitorNotAResponder : NSObject @end @implementation AMonitorNotAResponder { id eventMonitor; // An event monitor object; instance of // private class _NSLocalEventObserver } - (id)init { self = [super init]; if( !self ) return nil; NSEvent * (^monitorHandler)(NSEvent *); monitorHandler = ^NSEvent * (NSEvent * theEvent){ switch ([theEvent keyCode]) { case 123: // Left arrow

JavaFX TextField how to prevent key from getting typed in keypressed event

自闭症网瘾萝莉.ら 提交于 2019-12-18 09:05:08
问题 I need to detect the numpad key presses to do some stuff. here is the code: textField.setOnKeyPressed(new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent event) { if(event.getCode().isKeypadKey()) { //do stuff here... event.consume(); } } }); lets say user presses '2' on the numpad, although the event is consumed, the charachter '2' will appear in the textfield. but i dont want that. Any ideas how to prevent this? whats more interesting is that if i throw a dummy exception