keyboard-events

Keyboard input for a game in Java

拥有回忆 提交于 2019-11-27 15:19:56
I'm writing a game in Java, right now it's Swing + JOGL - a JFrame with a GLCanvas. I handle input using keyPressed etc. events ( jframe.addKeyListener(...) ) and it doesn't seem to work properly: when I have 3+ keys down at the same time, they don't register properly - apparently this is keyboard's fault, I have to find an alternate control scheme. after the window loses, then regains focus, input stops working completely... What am I doing wrong? Is there a better way of handling keyboard input in Java? (I'd rather not switch to another library, like LWJGL... unless I have no choice). To

How can I send keyboard commands (hold,release,simultanous) with a python script?

只谈情不闲聊 提交于 2019-11-27 14:13:44
问题 I want to send virtually the command like this: when keypress=="a" #if entered key is "a" send {ALT+TAB} # send ALT and TAB simultaneously sleep(2) #wait for 2 sec send {"I love my Country",0.1} #send all strings at 0.1 sec wait key_down("BACKSPACE",1) #hold down backspace key for 1 sec send{ALT+F4} #send ALT and F4 simultaneously For all, or a particular application, also opengl games as well. I tried SendKeys.py but there is no simultaneously input function and no key_down method for

Android custom keyboard popup keyboard on long press

丶灬走出姿态 提交于 2019-11-27 11:17:31
问题 I have custom Android keyboard: public class CustomKeyboard extends Keyboard{...} public class CustomKeyboardView extends KeyboardView{...} public class CustomKeyboardIME extends InputMethodService implements KeyboardView.OnKeyboardActionListener{...} On some keys, I have popupKeyboard and popupCharacters : <Key android:codes="144" android:keyLabel="0" android:popupKeyboard="@xml/key_popup" android:popupCharacters=")" android:keyEdgeFlags="right"/> xml/key_popup.xml: <Keyboard xmlns:android=

Android Use Done button on Keyboard to click button

天涯浪子 提交于 2019-11-27 10:32:42
Ok in my app I have a field for the user to input a number. I have the field set to only accept numbers. When the user clicks on the field it brings up the keyboard. On the keyboard (on ICS) there is a done button. I would like for the done button on the keyboard to trigger the submit button i have in my application. My code is as follows. package com.michaelpeerman.probability; import android.app.Activity; import android.app.ProgressDialog; import android.content.DialogInterface; import android.content.DialogInterface.OnCancelListener; import android.os.Bundle; import android.os.Handler;

Accessing Keys from Linux Input Device

隐身守侯 提交于 2019-11-27 09:26:11
问题 What I am trying to do So, I have been trying to access keyboard input in Linux. Specifically, I need to be able to access modifier key presses without other keys being pressed. Furthermore, I want to be able to do this without an X system running. So, in short, my requirements are these: Works on Linux Does not need X11 Can retrieve modifier key press without any other keys being pressed This includes the following keys: Shift Control Alt All I need is a simple 0 = not pressed , 1 =

How do you check for keyboard events with kivy?

眉间皱痕 提交于 2019-11-27 09:02:26
So, awhile ago, I started teaching myself kivy. I started with the main kivy website and went through its pong making tutorial and upon finishing that I decided to try and give it key input. I just can't seem to find any kind of guide to key input with kivy! Anyone know some kind of tutorial or can provide some easy to understand code? I did look at the Keyboard Listener in the examples folder of kivy, but I'm not quite sure how to use that if I'm supposed to. Thanks for any assistance. toto_tico I guess you are asking how to control the paddles with the keyboard. I assume you have the final

Type 'NSNotification.Name' has no member 'keyboardDidShowNotification'

耗尽温柔 提交于 2019-11-27 08:54:53
I'm getting this error with Swift 4.2 Type 'NSNotification.Name' has no member 'keyboardDidShowNotification' Here is my code: NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardDidShow(notification:)), name: NSNotification.Name.keyboardDidShowNotification, object: nil) Following one was working fine with Swift 4 but not with Swift 4.2 NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardDidShow(notification:)), name: NSNotification.Name.UIKeyboardDidShow, object: nil) Apple document Ref: NSNotification.Name.keyboardDidShowNotification I

How to tap (hook) F7 through F12 and Power/Eject on a MacBook keyboard

删除回忆录丶 提交于 2019-11-27 07:11:44
问题 This question follows from How to hook/remap an arbitrary keyboard event on OSX? So far I am able to tap the modifier keys and most of the other keys using: _eventTap = CGEventTapCreate( kCGHIDEventTap, kCGHeadInsertEventTap, kCGEventTapOptionDefault, CGEventMaskBit( kCGEventKeyDown ) | CGEventMaskBit( kCGEventFlagsChanged ) , (CGEventTapCallBack)_tapCallback, (__bridge void *)(self)); Notably, F3 correctly reports a keycode (160) before taking action. i.e. I can disable the action by having

Disable enter key in JQuery ui datepicker

守給你的承諾、 提交于 2019-11-27 06:54:37
问题 There seems to be a bug with JQuery UI datepicker, when user manually enters a date, and hits enter, the datepicker closes but focus stays on the field and therefor calendar won't open again until the textbox loses focus and gets it again. How can I supress the enter key behavior? Or are there any other known solutions for this seemingly known bug? Thanks! EDIT After working on this a bit more, this is the solution I came up with: $('#someid').bind('keydown', function(event) { if (event.which

Detect Keyboard Input Matlab

无人久伴 提交于 2019-11-27 06:46:57
问题 I have a simple question, although it's harder than it seems; I couldn't find the answer on the interwebs :O I'm writing a script in Matlab. What I want to do is the following: When I press the esc key, I want a helpdialogue to pop up, so my script pauses. (So when I press esc, I want to stop the whole script to run so that the car (which im writing the script for) stops driving) How do I do this? How can I say to Matlab: When I press esc, do this... Thanks for your time guys! EDIT: It's no