keypress

JavaScript keypress event get end value of textarea

我的未来我决定 提交于 2019-12-05 04:31:23
I was wondering if it were possible to get the end result in the keypress event? Currently, I am using the keyup because it is activated after the user has done text editing in a texteara, but I have written a method that does something similar using the Mootools library: input.addEvent("keypress", function (input) { var previous_result = this.value; var end_result = this.value + input.key; }); However, this method is horrible when dealing with special keys such as backspace, or if the user chooses to use CTRL + a && Backspace in which case the value of the input element would not be "an empty

jQuery Esc Keypress bind

我与影子孤独终老i 提交于 2019-12-05 01:35:39
I'd like to add a bind in which the Esc key will slide my panel back up. Here is my jQuery code. $(document).ready(function () { $(".port-link-container").click(function () { $("div.slider-panel").slideUp("slow"); }); $("#wr").click(function () { $('html, body').animate({ scrollTop: 450 }, 'slow'); $("div#wr-large").slideDown("slow"); }); $("#sema").click(function () { $("div#sema-large").slideDown("slow"); }); $(".slider-close").click(function () { $('html, body').animate({ scrollTop: 0 }, 'slow'); $("div.slider-panel").slideUp("slow"); }); }); #pannel { position:fixed; width:100%; height

Get a String from a collection of keys presses retrieved using Raw Input API

浪子不回头ぞ 提交于 2019-12-05 01:04:33
问题 I am using the Raw Input API to get a collection of key presses from a keyboard (actually, a magnetic stripe card reader that emulates a keyboard). Here are a couple of code excerpts so you can have an idea of how I'm getting the keys. [StructLayout(LayoutKind.Sequential)] internal struct RAWKEYBOARD { [MarshalAs(UnmanagedType.U2)] public ushort MakeCode; [MarshalAs(UnmanagedType.U2)] public ushort Flags; [MarshalAs(UnmanagedType.U2)] public ushort Reserved; [MarshalAs(UnmanagedType.U2)]

MATLAB: Pause program and await keypress

别来无恙 提交于 2019-12-04 21:12:10
问题 I am writing a program in which at some point a graph is plotted and displayed on screen. The user then needs to press 'y' or 'n' to accept or reject the graph. My current solution uses the PsychToolbox (the actual solution doesn't need to), which includes a command called 'KbCheck' which checks at the time of calling the state of all the keyboard buttons. My code looks like this: function [keyPressed] = waitForYesNoKeypress keyPressed = 0; % set this to zero until we receive a sensible

js: how to get LOCALIZED character on keypress?

风流意气都作罢 提交于 2019-12-04 19:52:16
问题 I need to get localized character on keypress event. For example: on czech keybord I need to get ř not 5 character (key code 53) (see Czech keyboard layout). Is there any other way to get character and to not use text input and reading value? By other words is there any way how to get character from event object respecting current user keyboard layout? (added sample code) <html> <body> <script language="JavaScript"> function onLoad() { console.log(document.getElementById("test")); document

WM_KEYDOWN - capturing keypress causing event [duplicate]

倾然丶 夕夏残阳落幕 提交于 2019-12-04 19:29:55
This question already has answers here : Keyboard Input & the Win32 message loop (2 answers) Closed 4 years ago . I am trying to do a very simple task - have an event occur when a key is pressed - but am having a lot of difficulty implementing it. I am using the Win32 API. I have been asked what framework I am using but I don't know that. I am using Visual C++ and the program is a Windows program. All I want to do is have an event occur if a specific key is pressed. For this example I am using the 's' key, and the event is an integer either being set to 1 or 0; whichever it wasn't set to at

JavaScript Keycode 46 is DEL Function key or (.) period sign?

↘锁芯ラ 提交于 2019-12-04 17:57:03
问题 Im writing some logic in JavaScript using jquery, where i must check the input content against a REGEX pattern ex: "^[a-zA-Z0-9_]*$" //Alpha-numeric and _ The logic is almost done, i just have a little problem filtering the function key DEL, my logic goes like this: var FunctionsKey = new Array(8, 9, 13, 16, 35, 36, 37, 39, 46); function keypressValidation(key) { if (config.regexExp != null) { if ($.inArray(key, FunctionsKey) != -1) { return true; } else { var keyChar = String.fromCharCode

How do I simulate a Tab key press when Return is pressed in a WPF application?

天大地大妈咪最大 提交于 2019-12-04 17:28:26
问题 In a WPF application, i have a window that has a lot of fields. When the user uses the TAB key after filling each field, windows understands that it moves on to the next. This is pretty know behavior. Now what I want to to, is make it simulate the TAB key, when in fact the RETURN gets hit. So in my WPF xaml I added imply KeyDown="userPressEnter" And in the code behind it: private void userPressEnter(object sender, KeyEventArgs e) { if (e.Key == Key.Return) { e.Key = Key.Tab // THIS IS NOT

Simulate Mouse move/click/keyPress in an application that is not active

左心房为你撑大大i 提交于 2019-12-04 14:38:51
问题 I know how to simulate mouse and keyboard events, but they act as if the user did them, so they will affect the window that is active. What I need is to simulate one of those inputs, but in a Window that is not active. I'm not saying that it is minimized, imagine for example, you have msPaint, and notepad. Notepad is in front of paint. And you want to simulate mouse clicks in certain coordinates of the paint window, but without setting it active, making it possible for the user to keep using

capturing global keypresses in Java

梦想与她 提交于 2019-12-04 14:15:25
So I want to trigger an event (pausing/unpausing some media) whenever the user presses spacebar anywhere in the my Swing app. Since there are so many controls and panels that could have focus, its not really possible to add keyevents to them all(not to mention gross). So I found KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher() which is awesome, you can register global keypress pre-handlers. There's a major problem though - spaces will be typed all the time in input fields, table cells, etc, and I obviously dont want to trigger the pause event then! So any ideas?