keypress

Firing down arrow key press in a select box via javascript

一曲冷凌霜 提交于 2019-12-04 13:41:36
问题 For strange reasons I have to change the selected element in a dropdownbox not via e.selectedIndex, but via the simulation of mouse and keypress events. I tried the following: //e = the dropdown e.focus(); //my custom function to fire mouse events. This opens the dropdown. fireMouseEvent("mousedown", e); //firing the key press, tried it via keydown, keypress and keyup. Nothing works. var evt = e.ownerDocument.createEvent("KeyEvents"); evt.initKeyEvent("keydown", true, true, null, false, false

Search datagridview on user keypress

别来无恙 提交于 2019-12-04 13:10:47
问题 I'm trying to select the first row where the cell value starts with the same keychar the user pressed. That's the part that is giving me trouble. Here's how I'm handling the event ( updated with working solution ): private void dataGridView1_KeyPress(object sender, KeyPressEventArgs e) { if (Char.IsLetter(e.KeyChar)) { for (int i = 0; i < (dataGridView1.Rows.Count); i++) { if (dataGridView1.Rows[i].Cells["Name"].Value.ToString().StartsWith(e.KeyChar.ToString(), true, CultureInfo

IE e.keyCode - How can I differentiate between ampersand and up-arrow?

我怕爱的太早我们不能终老 提交于 2019-12-04 10:59:36
问题 I am fighting with a very strange javascript behavior on a jQuery UI widget I'm trying to fix. IE7 (win XP), jQuery 1.2.6 (yes, it's an old version). The widget is a combo-box, which captures keyboard events and has special behaviors for the arrow keys. When I try to type the "&" character into the flexbox input field, I get strange behavior. The flexbox has some code like: //initialization $myInputElement.keypress($.flexbox.process_key); $.flexbox.process_key = function process_key(e) { $

How to detect pressed keys on the click of AngularJS

混江龙づ霸主 提交于 2019-12-04 09:58:59
问题 I'm using angularjs on a webapplication that i need to figure out how can i detect is keys like ctrl, shift or alt are pressed when i click some where. for example, with jquery i can do that by accessing the Click function arguments. Is there some out-of-the-box way to obtain that information on angular? 回答1: Take a look at this beautiful Stuff regarding AngularJS key handling So key code for Ctrl, shift, alt will be Ctrl - 17 Alt - 18 Shift - 16 Working Demo HTML <!DOCTYPE html> <html> <head

Press Enter Key in Selenium RC with C#

安稳与你 提交于 2019-12-04 08:33:55
How to press Enter using Selenium RC using C#? I am working with a SearchBox using Selenium . In which I have to type some name and I have to press Enter to search. There is no Submit button. So, I must use Enter . I tried something like this selenium.KeyPress("quicksearchtextcriteria", "13"); But doesn't work. Please Help. Note: I made a collection of possible ways to do this. See here: press enter key in selenium This can be achieved by Keys , and Enter . Example in Java as I don't know C#: import org.openqa.selenium.Keys; //... // this sends an Enter to the element selenium.type("locator",

Help: Maximum number of clients reached - Segmentation fault

安稳与你 提交于 2019-12-04 08:01:14
I want to simulate many key press events. I found a solution by using XTestFakeKeyEvent , but when I simulate more than 210 times my program raises a "Maximum number of clients reached" segmentation fault. I don't known how to solve this problem. My code here: #include <X11/Xlib.h> #include <X11/keysym.h> #include <X11/extensions/XTest.h> #include <stdio.h> #define PRESS_UP 0 #define PRESS_DOWN 1 #define PRESS_LEFT 2 #define PRESS_RIGHT 3 #define PRESS_ENTER 4 #define PRESS_ESC 5 #define PRESS_HOME 6 Display *display; unsigned int keycode; int press(int key){ display = XOpenDisplay(NULL); if

Qt Key Pressevent Enter

纵饮孤独 提交于 2019-12-04 07:29:00
void LoginModle::keyPressEvent(QKeyEvent *event) { qDebug() << event->key() << "\t" << Qt::Key_Enter << "\t" << QKeyEvent::Enter; if( event->key() == Qt::Key_Enter) OKButtonClicked(); else QDialog::keyPressEvent(event); } This code is very simple, class LoginModle inherits from QWidget . run this code and when I press Enter , it shows: 16777220 16777221 10 It means that my Enter in keyboard is 16777220 , but in Qt, it was defined as 16777221 . My system is Elementary OS (Freya), which is based on Ubuntu 14.04. Is there something wrong with my driver or just the program's mistake ? 16777220(dec

Simulate pressing [enter] key on input text

社会主义新天地 提交于 2019-12-04 06:58:50
My code worked perfectly on changed the value of input automatic on page load with a delay between it. But there's another problem, When I tried to simulate pressing the [enter] key on the input, it's no working, and it's submit the form and reload my page instead. How I simulate pressing the [enter] key in the input without submit the form and without reload my page? I am use pure javascript without jQuery This is my script : var form = document.querySelectorAll("._k3t69"); var input = document.querySelectorAll("._7uiwk._qy55y"); var message = "Replacement..." ; var maxMsg = 3 ; var delay = 2

Get KeyCode value in the KeyPress event

只愿长相守 提交于 2019-12-04 06:34:43
问题 How to fix this error: 'System.Windows.Forms.KeyPressEventArgs' does not contain a definition for 'KeyCode' and no extension method 'KeyCode' accepting a first argument of type 'System.Windows.Forms.KeyPressEventArgs' could be found (are you missing a using directive or an assembly reference?) Code: private void Form1_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyCode == Keys.Enter) { MessageBox.Show("Enter Key Pressed "); } } I'm using Visual studio 2010, framework 4 for this

Texbox input, disable for keyboard, keep for barcode scanner

坚强是说给别人听的谎言 提交于 2019-12-04 05:41:47
问题 I have made a Windows Form application with a textbox. I will force users to use the barcode scanner, so the keyboard input should be disabled. The KeyPressed event does not work, because is also disabled input from the barcode scanner. I thought maybe I can set a timer on the TextChanged event, but I do not really know how it works. Have someone a good idea? 回答1: Based on your description, I assume that your barcode scanner is an HID barcode scanner. If so, there is no easy answer here