Questions tagged [key-events]

An event that is triggered when a Key is pressed on a keyboard input device

A KeyEvent is an event that is triggered when a Key is pressed on a keyboard input device. The event will contain information relating to the particular key that was pressed, how long the key was pressed for, and whether any modifier keys were also pressed (such as Ctrl or Alt).

204 questions
4
votes
1 answer

Replace keyAdapter with key binding

How could I use key bindings in this code as key adapter doesn't work well? I already looked at the documentation of key binding but I can't understand how to do this. private class KeyLis extends KeyAdapter { @Override public void…
sanchixx
  • 275
  • 2
  • 5
  • 12
4
votes
2 answers

How to get started with c# for testing keypressed event?

I am quite new to c#, and the first thing i want to do is being familiar with that environment by trying Key's Combination Events. In particular, alt+k. I'm working on Microsoft Visual c# 2010 Express. I want to test if that code works. If errors…
user2305415
  • 172
  • 1
  • 3
  • 18
4
votes
2 answers

Fire a JButton with spacebar, or enter key, or mouse click

I'm trying to get a simple JFrame with a single button to fire an event when any of these events happen: The Enter key is pressed AND the JButton has focus The Spacebar is pressed AND the JButton has focus The JButton is clicked. It seems that the…
Paul N
  • 57
  • 1
  • 7
3
votes
3 answers

How to trigger onkeydown event on HTML document

I want to trigger the onkeydown event on the html page to do some actions. I have the following code: document.onkeydown = function(){ alert('dd'); }; Is it possible to trigger this event on whole page or is it limited to only editable html…
Suraj
  • 43
  • 1
  • 6
3
votes
1 answer

Set form input value to "" doesn't clear spaces

I am trying to implement a command line emulator in JavaScript. I want the Spacebar key to act as Enter (submit, then clear the command line). In this post, let's represent a space as an underscore, so _ means [space]: If I enter banana_ and then,…
Hans
  • 158
  • 5
3
votes
3 answers

RecyclerView crashes on scrolling

I have some images arranged in horizontal grid. I want to move my grid from left to right and right to left using key events. When I move through the grid two things happened The item at second position is selected. For example, I'm at position 0…
Andrain
  • 872
  • 1
  • 16
  • 43
3
votes
0 answers

How to simulate keyboard right click with java robot class

I am trying to simulate right click event using java robot class. but here my problem is I should use keyboard right click button, but not mouse right click(InputEvent.BUTTON3_DOWN_MASK). Can any one suggest how I can do this?
kamesh
  • 391
  • 2
  • 3
  • 11
3
votes
1 answer

show hide no of divs according to the current index jquery

I am working with jQuery index. Here I need to add and remove divs according to the current index. What I looking for is I need to remove first four divs when my current index is greater than 7 and I need to show those removed first four divs again…
WP Learner
  • 788
  • 1
  • 13
  • 34
3
votes
3 answers

Why are numeric keypad numbers and regular numbers not the same in KeyEvent?

This code does not allow me to enter numeric values from a numeric keypad. private void textBox1_KeyDown( object sender, KeyEventArgs e ) { e.SuppressKeyPress = !( (e.KeyValue >= 48 && e.KeyValue <= 57) ) } How can I include numerical values in…
Naveen Kumar V
  • 2,559
  • 2
  • 29
  • 43
3
votes
2 answers

How to convert gchar* to char

When I press a key(integer) on my keyboard. It does something like: gchar *keypressed; keypressed=gdk_keyval_name (event->keyval); printf("The KeyEvent is: %s\n", keypressed); // Till here it is fine I get segmentation fault when I do…
djgharphalia07
  • 227
  • 3
  • 14
3
votes
5 answers

Unable to lose focus from an iframe on keypress

I have a iframe in my html page. I have attached key events on my html document. When I pressed "a" or "z" I can do something like addClass or removeClass. So in that block when I try to add focus to an iframe it gets added. But with a key event I…
Ashwin
  • 12,081
  • 22
  • 83
  • 117
3
votes
3 answers

Activity's onBackPressed method is never invoked

I am attempting to intercept back button events in my app for some custom functionality, but nothing I've written in the relevant callbacks is being executed, and I can't for the life of me understand why. Here are my overridden…
RocketGuy3
  • 585
  • 1
  • 10
  • 24
3
votes
1 answer

How to prevent JTable from returning to the first row when Tab is pressed?

How can I disable JTable's default behaviour of returning to the first row, when tab key is pressed in the last cell of the table? Instead the current cell should keep its focus.
Pedro
  • 4,100
  • 10
  • 58
  • 96
3
votes
2 answers

Change the mouseless-modifier in Java?

CLARIFICATION: Is there a easy/simple way to change the default mask (ALT on my system) so that things like JMenu's don't, by-default, utilize the default mask + mnemonic (ALT + VK_A, for example) for access? Or is this something that should only…
Azoreo
  • 236
  • 1
  • 3
  • 14
3
votes
4 answers

Check for CapsLock ON in "onfocus" event

My following code for checking whether Capslock is on or not works fine on "onkeypress" event. But i want it for "onfocus" event. i tried replacing "onkeypress" with "onfocus" for the control,but it doesnt work for me. Any help? (either in…
Santosh
  • 2,355
  • 10
  • 41
  • 64
1 2
3
13 14