key-bindings

Java Swing: Show pressed button when using corresponding keyboard button

混江龙づ霸主 提交于 2019-12-05 08:34:38
I'm making a program in Java, using Swing, with a GUI that contains arrow keys. The arrow keys correspond to the arrow keys on the keyboard. When I press the up arrow key on the keyboard, I'd like the up arrow key on the GUI to show up as being pressed. Until I release the arrow key, it should show it is still being pressed, and when released it should also release. A snippet of my code so far (only for the Up button), which I think is totally wrong in the show being pressed category: ... if (e.getKeyCode() == KeyEvent.VK_UP) { actionArrowUp(); JButton buttonUp = (JButton) mainTab.getComponent

Disable Enter Key from moving down a row in JTable

人走茶凉 提交于 2019-12-05 01:34:46
问题 I need to override the enter key functionality on a JTable. At present the default behaviour is to move the row selection down one row when the user presses the 'Enter' key. I want to disable this and get it to do something different based on their selection. The problem is that it seems to move down before it goes into my keylistener which takes in the row selection - this therefore opens another window with the wrong row selected. This is my code so far...: public class MyJTable extends

How to change smart assign key (“_” to “<-”) binding in ESS

*爱你&永不变心* 提交于 2019-12-04 20:15:46
In emacs ESS, how do I correctly change the keybinding for ess-smart-S-assign? What I tried is adding (custom-set-variables '(ess-smart-S-assign-key ":")) to my .emacs , but that made weird things happen: When I press : , just a normal : appears. On the other hand, pressing _ once yields <- as usual, whereas pressing _ a second time then converts this to : . The desired behavior would be to be able to use _ as a normal key, with : being converted to <- . I am using the official emacs 24.3 for windows and the latest development version of ESS (14.06). Here's the docstring for ess-smart-S-assign

How to find the location, where an an Emacs Lisp function is bound to a key?

[亡魂溺海] 提交于 2019-12-04 17:23:15
I'm trying to figure out where M-m is bound to back-to-indentation function. When I issue C-h k M-m ( describe-key ), I get the following output M-m runs the command back-to-indentation, which is an interactive compiled Lisp function in `simple.el'. It is bound to M-m. (back-to-indentation) Move point to the first non-whitespace character on this line. When I look at simple.el , I'm seeing only the definition of function back-to-indentation . I searched throughout the file and I didn't see any keybinding done for that function using define-key . I'm assuming that it happens elsewhere. How can

How do you bind Enter and Esc keys to OK and Cancel buttons respectively in a WPF dialog?

浪子不回头ぞ 提交于 2019-12-04 15:05:47
问题 My WPF app uses a dialog with Ok and Cancel buttons. I would like to bind the Enter key to the Ok button and the Esc key to the Cancel button. Seems like it should be a simple thing to do. 回答1: Try setting the IsDefault property on the ok button to true, and the IsCancel property on the cancel button to true. 来源: https://stackoverflow.com/questions/2031322/how-do-you-bind-enter-and-esc-keys-to-ok-and-cancel-buttons-respectively-in-a-wp

Override the enter key, but keep default behavior for other keys in a wpf datagrid

倖福魔咒の 提交于 2019-12-04 09:55:21
It really bothers me that the pressing the enter key in a Datagrid moves the selection down one item, I'd like to be able to decide what it does in a normal keydown event. So what I did was create a new class that inherits DataGrid and override the OnKeyDown event and use that as my datagrid. This creates a whole new set of problems, since I apparently have to rewrite all the other keypresses (arrow key navigation, shift+arrow key selection, pgup/pgdn, etc..). I've been trying to hack it, but it just seems so pointless spending time rewriting something that has already been written and

How to turn off alternative Enter with Ctrl+M in Linux

不打扰是莪最后的温柔 提交于 2019-12-04 08:25:31
问题 Why is Ctrl+M bound to Enter in Ubuntu Jaunty? How to turn it off? I'm using Emacs and would like to bind Ctrl+M to some other command. 回答1: I think your question is backwards. It is not C-m that is bound to Enter , it is Enter that is bound to C-m . And C-m is the same as RET . If you run C-h k C-m , you will see something like " RET runs the command ... ". C-m sends RET because it is a control code, see http://en.wikipedia.org/wiki/Control_character. The Enter key is bound to C-m ; if you

How to Pass Cell Information from DataGrid in WPF KeyBinding?

拈花ヽ惹草 提交于 2019-12-04 06:18:18
问题 I'm having a DataGrid to list the MobileInfo Collection. The DataGrid is Configured with SelectionUnit="FullRow" . If I Click the any Row then it selects the entire row with additionally it points the Cell with border where the Mouse was hit. The Border Selection moves while on Keyboard navigation For Example : Left , Right , Up and Down . Based on the Cell Selection I wish to Pass the Information about the Cell. Refer the Image it has the Output Screen In the above Screen Shot the Android is

Create a single key-binding that fires a command every time control is pressed with any number and then passes the number as a parameter?

烂漫一生 提交于 2019-12-04 05:01:18
I need to create hot-keys for every control + number combination and would prefer not to have create ten commands. Is there any way to do this? If I understand your question, you have a single command, say MyCommand , and you want to fire it if the user presses CTRL+0 through CTRL+9, and give the command a different parameter for each combination. In that case, just create 10 key bindings in your window, all bound to MyCommand , and give them a parameter: <Window.InputBindings> <KeyBinding Command="MyCommand" Gesture="Ctrl+0" CommandParameter="0"/> <KeyBinding Command="MyCommand" Gesture="Ctrl

Difference between KeyBindings and KeyListeners

可紊 提交于 2019-12-04 04:30:04
问题 What is the point of KeyBindings if you could just do: // Imports public void Test { JButton button1; JButton button2; JButton button3; ... Test() { button1 = new JButton(); button1.addKeyListener(this); button2 = new JButton(); button2.addKeyListener(this); button3 = new JButton(); button3.addKeyListener(this); ... } public void keyPressed(KeyEvent e) { } public void keyReleased(KeyEvent e) { } public void keyTyped(KeyEvent e) { Object src = e.getSource(); if (src == button1) { ... } else if