FAQ Database Discussion Community


Handling Alt + Enter key press in JavaScript

javascript,javascript-events,keypress,keyboard-events
I'm trying to get some pure JavaScript code to handle Alt + Enter key press event in a text area but am failing miserably. What is wrong? Html <textarea id="ta" style="width:100%;height:500px"> </textarea> JavaScript var ta = document.getElementById('ta'); ta.onkeypress = function(e) { if (e.charCode == 10 && e.altKey){ alert( "Key Pressed:...

KeyUpHandler firing only once

gwt,keyboard-events
I'm trying to make a KeyUpHandler work (popup the value of the TextBox) for a TextBox widget. In the simple implementation below it only fires once and then it throws an error in the firefox console: uncaught exception: java.lang.AssertionError: Negative entryDepth value at exit -1 I use run as superdev...

Disable keyboard shortcut when Colorbox Event is fired and then Restore it when another Event fires?

javascript,jquery,colorbox,keyboard-events
I am using the jQuery Colorbox library which is a library of creating Modals that can load images and other content in a nice popup modal window. I am using it on my portfolio/projects page to allow clicking on a screenshot image and it will load a larger view of...

Prevent Addition input

javascript,events,input,onchange,keyboard-events
I want to stop taking input in the text field once 10 characters have been entered. What I have so far is not working: $(document).ready(function() { $('#comment').keypress(function(event){ if ($('#comment').val()).length == 10) { event.preventDefault(); } }); }); What am I missing?...

On button action NSNotificationCenter Rises again the keyboard

keyboard-events,nsnotificationcenter
I am not able to sort of where is the mistake in my code . When i click the "Submit" button then the keyboard rises again. Here i am using the NSNotificatioCenter which scrolls the view according to keyboard height. Have a look on code below. -(void)viewDidLoad { [super viewDidLoad]; [[self...

Software debounce for Android buttons

android,android-button,keyboard-events,bounce
I have a simple ImageButton in my Android program which, when clicked, appends a "0" in a TextView. When this button is long clicked, it is supposed to append "+" in that TextView. The program works fine but I'm facing a typical key bouncing effect. When I long press the...

How to detect backspace in a keyTypedEvent

java,netbeans,keyboard-events,backspace
I'm using Netbeans' bean form to create my GUI.I've added a keyTyped event to a JTextArea and I want to detect if the typed key is a Backspace. I'm using keyTyped event for other reasons so I cannot just use the keyPressed event. This is the generated code (and my...

How can i capture Key press events?

c#,winforms,keypress,keyboard-events
I'm trying to have 2 different message box display when "Ctrl+l" is pressed and another when "Shift+A" is pressed as well. I have everything done but when i press these button while the program is running, nothing happens. I'm not sure what i have done wrong. My code as follows:...

Understanding multiple keys with WPF KeyDown event

c#,wpf,keyboard-events
I'm using WPF KeyDown event. Can you please explain why this condition is true, when I press Ctrl+F1? When I press F1, Ctrl is already pressed so !Keyboard.IsKeyDown(Key.LeftCtrl) should be false. Edit: In the code below if you press Ctrl+F1 both messages would fire. But if you change the order...

Close JS Menu on ESC

jquery,html,css,keyboard-shortcuts,keyboard-events
I am working on a simple slide-in menu system. I'd like to be able to close a menu by hitting the ESC key. Here's my current code: http://jsfiddle.net/3w539Lct/3/ Line 126 of my Javascript, you can see: $( document ).on( 'keydown', function ( e ) { if ( e.keyCode === 27...

shift mouse click trigger

javascript,jquery,keyboard-events
I can trigger click event on element selector using trigger $('element selector').trigger('click') Is it possible to trigger shift click. I mean shift + left mouse click....

Program that either waits for user input or runs at defined intervals?

python,multithreading,user-input,keyboard-events
I currently have a program that runs at regular intervals. Right now the program runs continuously, checking for new files every 30 minutes: def filechecker(): #check for new files in a directory and do stuff while True: filechecker() print '{} : Sleeping...press Ctrl+C to stop.'.format(time.ctime()) time.sleep(1800) However, I'd also like...

How to remap keyboard within the same textarea

javascript,jquery,html,keyboard-events,keyup
Currently i am doing a project with remapping characters to words by detecting the keyup function. Unfortunately, i have only been able to retrieve the first character and remap to the word i want. In my project, i need to directly retrieve all of my keyboard input and directly convert...

How to change input/textarea value with custom keyboard event and keyCode?

javascript,javascript-events,keyboard-events
I would like to populate a textarea by triggering keyboard events, such as keydown (I'm doing this for a test case). I have added a snippet (below) to show the code I'm using to create and trigger the event. The event fires, but the textarea never receives the value of...

Calculate the time between a range of key events in Python

python,events,tkinter,keyboard-events
As a part of my self learning projects, I decided to create an application in Python that listens to certain keyevents and finds the amount of time it takes to type a word. It's been more than 12 hours of straight debugging and loop/logic experiments and all I could do...

How to check if keyboard is visible in swift

ios,xcode,uitableview,swift,keyboard-events
In my app the keyboard is supposed to be up when someone is pressing a text label in a tableview cell. My problem is that the tableview is reloading when new data arrives and the keyboard goes down all the time. I want to check somehow if the keyboard is...

keypress event on display button by keyboard click [closed]

javascript,javascript-events,keyboard-events
needs to activation html button <td> <input name="Eight" type="Button" class="Gray" value="8" onclick='take("8")' /></td> by keyboard event, how can I do this? What mean key in keydownFunction(key)? and doSomething() is function instead take("8") in onclick= ? Really dull questions but I'm really don't understand system to call by keyboard events %)...

How to check if key pressed when clicked event in java

java,event-handling,mouseevent,keyboard-events
I want to catch the Clicked event in java when key pressed (not ctrl, or shift, or alt), or check if key "A" press druing key "D" pressed. How can i do that, something like the method isshiftdown ?

CGEventTapCreate and CFMachPortCreateRunLoopSource fails EXC_BAD_ACCESS

xcode,osx,keyboard-events,cgeventtap,media-keys
I am trying to tap into the HID events of OSX. I found a snippet for testing it. However my code always seem to fail with EXC_BAD_ACCESS at the CFMachPortCreateRunLoopSource line. It seems that downEventTap is null. Reading the documentation tells me that this needs to be run on the...

Launch application function using keyboard shortcut in GNU/Linux

c++,c,linux,qt,keyboard-events
I created an application using Qt in GNU/Linux and I run in the background. I want to execute certain application functionalities when user presses some key combinations, for example Ctrl+Alt+A... I know it is possible, Gnome Pie does it but I don't know how I can capture the keys. I...

Setting OS Specific Keybindings - Cmd on Mac and Ctrl on Everything Else

javascript,osx,keyboard-shortcuts,keyboard-events
When configuring the Ace editor, you have the option to set OS specific keybindings, like {win: "Ctrl-Esc", mac: "Cmd-Esc"}. This works, so obviously OS specific bindings can be done in JS. How do you define shortcuts (on any element) that require that the user holds Cmd on OS X and...

Change focus on next input after paste event with JQuery

javascript,jquery,html,javascript-events,keyboard-events
I have got an HTML form with many input boxes. At the paste event on any of my input boxes I would like to set the focus on the following one. Here is the code I am currently using: $("input").bind('paste', function(e) { var inputs = $(this).closest('form').find(':input'); //alert(e.originalEvent.clipboardData.getData('Text')); inputs.eq( inputs.index(this)+ 1...

How to make key events work on a JDialog while there is a JTextArea on it?

java,jtextarea,keyboard-events,jdialog
What I have basicly created is a JDialog which has a key event on the form. So when for example space is pressed it does something. This worked fine until I created a JTextArea on the same dialog, which is editable. When I did this I can't remove the focus...

Capture the space key in a window containing several NSTextFields

objective-c,osx,cocoa,keyboard-events,nstextfield
I have a large window with a number of NSTextField fields on it, and I would like to intercept the space bar even while any of the text fields have focus, so that pressing space at any time will cause a separate action. Subclassing NSTextField and overriding -keyUp: allows me...

TableView - Attempting to make it behave like Excel

java,javafx,tableview,keyboard-events,javafx-1
I'm attempting to make TableView behave like Excel. I am having trouble selected the correct cells. In Excel, if you select a column(say 5 adjacent cells in the column) and then you click SHIFT + LEFT, excel will automatically select all corresponding left most cell. e.g. Say in Excel I...

Key Listener not working in JApplet

java,swing,applet,keyboard-events
This is a break the brick type of game where the user cannot let the ball fall below the paddle. By the way paddle_x is sets the x coordinate of the paddle. I have a MouseListener that works very well however, the KeyListener does not. I am wondering what I...

OS- How to properly print a spacebar in the video memory in a kernel?

c,keyboard,operating-system,keyboard-events
I know this the title is weird (I don't know how to explain it :| )but if u see my problem u will get it. I am making an os in assembly and c i have made a kernel and i have text input and output but i am having...

Multiple keys with WPF KeyDown event

c#,wpf,keyboard,keyboard-events,keydown
I'm working with WPF KeyDown event (KeyEventArgs from Windows.Input). I need to recognize when user pressed F1 alone and Ctrl+F1. private void Window_KeyDown(object sender, KeyEventArgs e) { if (e.Key==Key.F1 && Keyboard.IsKeyDown(Key.LeftCtrl)) { MessageBox.Show("ctrlF1"); } if (e.Key == Key.F1 && !Keyboard.IsKeyDown(Key.LeftCtrl)) { MessageBox.Show("F1"); } } My problem is that when I...

How to detect shift + right arrow + some other key in angular

javascript,angularjs,keyboard-shortcuts,keyboard-events,keyup
I have a problem to detect shift + right arrow + p in angular. I am using angular 1.2.3 I have no problem to detect only right arrow + p but when the shift comes into game something brakes The question is hot to detect situation when 3 keys are...