keyboard-events

javascript, simulate keyboard events, work on chrome(webkit)

白昼怎懂夜的黑 提交于 2019-12-18 05:18:29
问题 in FF, i've used this code: if (keyCount == lineLimit) { // method in FF, no Chrome var mock = document.createEvent("KeyboardEvent"); // or KeysEvent mock.initKeyEvent("keypress",true,true,null,false,false,false,false,14,0); var x = document.getElementById('InputCategory'); // rise height before Enter $(this).height(div_height + font_height + offset_height); // mock Enter x.dispatchEvent(mock); // init keyCount keyCount = 0; } it works, but could not be effective on webkit-based browsers like

Catching event when following a link

好久不见. 提交于 2019-12-18 03:35:58
问题 I am trying to track clicks on an external link (without using a "redirect page"). How can I capture an event when a user follows a link, regardless of whether the user: Left clicks on the link Right clicks on the link and open it in a new window Use the keyboard to activate the link Is there other ways to activate a link? The onClick event only applies to the first. If setting href="javascript:fireEventAndFollowLink()" the user will not be able to open the link in a new window (2), so this

Flush/Clear System.in (stdin) before reading

只愿长相守 提交于 2019-12-17 21:13:11
问题 At work, we have 5 RFID readers attached to a PC running Linux. The readers are all recognized as keyboards and send their input (what they read form the Chip) as an key-input-event sequence. To be able to tell which reader send what sequence, I'm doing a raw-read over /dev/input/XX and get their input this way. The problem with this is, that the send keyboard-events generated by the RFID readers are still "in" stdin and when I try to read from System.in via Scanner (input should be generated

Stop Enter/Return key submitting a form [duplicate]

有些话、适合烂在心里 提交于 2019-12-17 17:06:28
问题 This question already has answers here : Prevent users from submitting a form by hitting Enter (31 answers) Closed 3 years ago . I have a table within a form. The table contains some form fields, but there are form fields outside of the table (but still within the form) too. I know that Enter and Return are traditionally used to submit a form via the keyboard, but I want to stop this behaviour for fields within the table. For example, if I focus a field within the table and hit Enter/Return,

KeyboardEvent in Chrome, keyCode is 0

戏子无情 提交于 2019-12-17 15:53:49
问题 I am trying to set keyCode on dispatched event object . On button click, event is raised on textbox control to simulating keydown event. Event is raised successfully, but keyCode is 0. I need to send event object with correct keyCode to textbox. I've been using code from here. How to set keyCode value in dispatched event? <html> <head> </head> <body> <input type="button" id="btn" value="Click"></input> <input type="text" id="txt"></input> <script> document.getElementById('btn')

Keyboard input for a game in Java

六眼飞鱼酱① 提交于 2019-12-17 12:37:05
问题 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

FullScreen Swing Components Fail to Receive Keyboard Input on Java 7 on Mac OS X Mountain Lion

╄→гoц情女王★ 提交于 2019-12-17 10:57:33
问题 Update 12/21: 7u10 was recently released. Confirmed that: The issue still persists Thankfully, the workaround still functions! Update 11/7: And we have a workaround! Leonid Romanov from Oracle on the openjdk.java.net mailing list provided some insight as to what's going on: Well, although I'm not 100% sure yet, but it looks like when we enter full screen some other window becomes the first responder, hence the beep. Could you please try the following workaround: after calling

Android Use Done button on Keyboard to click button

南笙酒味 提交于 2019-12-17 10:12:47
问题 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

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

落花浮王杯 提交于 2019-12-17 09:45:17
问题 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

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

孤者浪人 提交于 2019-12-17 09:45:16
问题 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