keyboard-events

Detect Keyboard Input Matlab

孤人 提交于 2019-11-28 12:08:08
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 option to implement something which awaits the keypress. Im writing a script for a driving car. It just

Ruby Keyboard event handling

不想你离开。 提交于 2019-11-28 11:26:43
问题 Hello im using curses to develop a small console application. I have a main loop section wich waits for user input, it uses the getstr function, of course this waits for the user to press enter. I would like to capture the up and down and tab keypresses. I suppose this can't be done with getstr. Anyone have any idea how to do this? EDIT: i've tried using STDIN.getc wich blocks the application from running, and getch doesnt catch the arrow keys EDIT #2 : im trying this code on windows. It

change keyboard layout with javascript

本小妞迷上赌 提交于 2019-11-28 10:00:33
I have a html form. Users can fill in the form in both english and persian languages. but I have a captcha input that users should fill it in english. If the user's keyboard layout is persian what is typed in this field should change to english so I need some coded that change the keyboard layout on focusing on this input text. Is it possbile to change keyboard layout with javascript?? You won't be able to change the keyboard layout using JS, but you can capture the keydown event and replace the character with something like this: http://jsfiddle.net/SxdKZ/ $('textarea').on('keydown', function

NSNotificationCenter Swift 3.0 on keyboard show and hide

时光总嘲笑我的痴心妄想 提交于 2019-11-28 09:51:41
I am trying to run a function when the keyboard shows and disappears and have the following code: let notificationCenter = NotificationCenter.default notificationCenter.addObserver(self, selector: #selector(ViewController.keyBoardUp(Notification :)), name: NSNotification.Name.UIKeyboardWillShow, object: nil) And the function keyBoardUp below: func keyBoardUp( Notification: NSNotification){ print("HELLO") } However the function doesn't print to the console when the keyboard shows. Help would be greatly appreciated Swift 3: override func viewDidLoad() { super.viewDidLoad() NotificationCenter

Hitting Tab in Visual Studio selects block instead of adding indentation

泪湿孤枕 提交于 2019-11-28 09:35:07
I am using Visual Studio 2015 and ReSharper 2016.2 and I have this strange behavior, that I probably activated (accidentally). When having the cursor in a line before the first word, hitting the Tab-key indents the line correctly: When the cursor is inside of any word inside the line, hitting the Tab-key selects the word or block. But the desired behavior would be to indent at the cursor (e.g. split a word into two words, if the cursor was inside of the word Stream after the letter r): Does anyone know how this 'feature' is called? Does it come from ReSharper? Where can it be enabled or

Send mouse & keyboard events

删除回忆录丶 提交于 2019-11-28 09:21:40
I'm developing an app that have to send some keys or mouse events to the active window. I'm using this class: Mouse using System.Runtime.InteropServices; using System.Windows.Forms; namespace Mouse { public static class VirtualMouse { // import the necessary API function so .NET can // marshall parameters appropriately [DllImport("user32.dll")] static extern void mouse_event(int dwFlags, int dx, int dy, int dwData, int dwExtraInfo); // constants for the mouse_input() API function private const int MOUSEEVENTF_MOVE = 0x0001; private const int MOUSEEVENTF_LEFTDOWN = 0x0002; private const int

Trigger a keyboard key press event without pressing the key from keyboard

两盒软妹~` 提交于 2019-11-28 08:41:17
How can I trigger a key press event without pressing the key from Keyboard? I tried with the solution from here , but I got the following exception: The best overloaded method match for 'System.Windows.PresentationSource.FromVisual(System.Windows.Media.Visual)' has some invalid arguments. Consider Shift+A contains 2 key press event from keyboard,how can I do it without keyboard pressing?(let, just print capital A in a textbox on a button click) My code var key = Key.A; // Key to send var target = Keyboard.FocusedElement; // Target element var routedEvent = Keyboard.KeyDownEvent; // Event to

How to prevent number input on keydown?

十年热恋 提交于 2019-11-28 07:38:42
I want to prevent number input on keydown event on textfield and run custom handler function. Here are the issues e.target.value is useless since the key value is not projected into the target value yet e.keyCode for number depends on keyboard type, language layout, Fn or Shift key String.fromCharCode(e.keyCode) is not reliable, at least on my keyboard (Czech qwerty) w3 specification says e.keyCode is a legacy attribute and suggests e.char instead, but it is not implemented in browsers yet So how to catch the number input before it appears in the textfield? Use the keypress event instead. It's

How to simulate typing in input field using jQuery?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-28 04:29:55
What I want is to simulate typing in <input> field using javascript. I have the following code: var press = jQuery.Event("keydown"); press.ctrlKey = false; press.which = 65; $("#test").trigger(press); But when I load the page, the #test input field has no typed characters, the keycode of '65' represents 'A', but there is no 'A' input. Basically what I want is to automatically typing in the website using Greasemonkey. Please give me some ideas or some library with which I can use to do this. Thanks a lot! You can send key events, and anything listening for them will get them, but they will not

Capture the events of 2 or more keyboards in JavaScript/Web Browser

夙愿已清 提交于 2019-11-28 04:17:11
问题 I am writing some test applications that perform simple keyboard event capture. I have no problem with this basic approach. But now I need a better experience with my application and I want to connect at least two or more USB or PS/2 keyboards, distinguishing what keyboard is the source of the key events, and so being able to use the web browser locally with JavaScript (and HTML5), as if it was a game console with several controllers for more than one player, simultaneously. I know that even