key-bindings

Java KeyListener vs Keybinding

依然范特西╮ 提交于 2019-11-27 02:13:47
i am trying to write a calculator and having a problem. I already made a actionlistener for all buttons and now i want to make it possible to input data from keyboard. DO i need to do the whole thing for KeyListener or Keybinding or is there any other a way to make that after clicking a button it will be sent to the instructions in actionlistener? And whats better:Keylistener or Keybinding Generally speaking, where you have a limited set of key inputs, key bindings are a better choice. KeyListener suffers from issues related to focusability and with other controls in the GUI, focus will

How to bind Ctrl+/ in python tkinter?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 01:23:29
问题 <Control-Shift-Key-0> <Control-Key-plus> works but <Control-Key-/> doesn't. I am unable to bind ctrl + / in python. Is there any documentation of all the possible keys? 回答1: Use <Control-slash> : def quit(event): print "you pressed control-forwardslash" root.quit() root = tk.Tk() root.bind('<Control-slash>', quit) # forward-slash # root.bind('<Control-backslash>', quit) # backslash root.mainloop() I don't have a link to a complete list of these event names. Here is a partial list I've

How do I bind the enter key to a function in tkinter?

断了今生、忘了曾经 提交于 2019-11-27 01:17:48
I am a Python beginning self-learner, running on MacOS. I'm making a program with a text parser GUI in tkinter, where you type a command in a Entry widget, and hit a Button widget, which triggers my parse() funct, ect, printing the results to a Text widget, text-adventure style. > Circumvent the button I can't let you do that, Dave. I'm trying to find a way to get rid of the need to haul the mouse over to the Button every time the user issues a command, but this turned out harder than I thought. I'm guessing the correct code looks like self.bind('<Return>', self.parse()) ? But I don't even

Emacs Keybindings in Visual Studio 2012 or 2013

别等时光非礼了梦想. 提交于 2019-11-26 22:31:55
问题 I would prefer to have Emacs keybindings in MSVS. In MSVS 2008, this was natively supported, and in MSVS2010 there was an extension to achieve this http://blogs.msdn.com/b/visualstudio/archive/2010/09/01/emacs-emulation-extension-now-available.aspx Can i install this extension in MSVS 2012? (I have thus far been unsuccessful...) Is there another way to achieve Emacs keybindings? 回答1: I figured out how to get the emacs emulation extension for VS 2010 to install and run on VS 2012. This is a

How can I listen for keypress event on the whole page?

▼魔方 西西 提交于 2019-11-26 22:31:53
问题 I'm looking for a way to bind a function to my whole page (when a user presses a key, I want it to trigger a function in my component.ts) It was easy in AngularJS with a ng-keypress but it does not work with (keypress)="handleInput($event)" . I tried it with a div wrapper on the whole page but it doesn't seem to work. it only works when the focus is on it. <div (keypress)="handleInput($event)" tabindex="1"> 回答1: I would use @HostListener decorator within your component: import { HostListener

Calculator application including keyboard input in java swing

♀尐吖头ヾ 提交于 2019-11-26 22:05:57
问题 I have a calculator application in java swing, which is working properly with mouse click input. Now I want it to read input using keyboard button stroke. I had heard about the glass pane in java tutorial, but i need to know any other simple method to meet the requirement. 回答1: KeyPadPanel is an example that uses Action and Key Bindings for numeric entry. 来源: https://stackoverflow.com/questions/10099686/calculator-application-including-keyboard-input-in-java-swing

Comparing functionality between KeyListeners and Key Bindings

耗尽温柔 提交于 2019-11-26 21:38:11
问题 This question arose when an anonymous user downvoted an answer of mine involving KeyListeners and suggested the use of Key Bindings instead. This anonymous user informed me that the KeyListener interface was an old AWT solution and should not be used. However, I don't know if I should trust that information completely. I have researched both on various websites, oracle included, and found nothing regarding the functionality of KeyListeners or Key Bindings. I am aware of the fact that the two

Emacs on Mac OS X Leopard key bindings

∥☆過路亽.° 提交于 2019-11-26 21:09:09
I'm a Mac user and I've decided to learn Emacs. I've read that to reduce hand strain and improve accuracy the CTRL and CAPS LOCK keys should be swapped. How do I do this in Leopard? Also, in Terminal I have to use the ESC key to invoke meta. Is there any way to get the alt/option key to invoke meta instead? update: While the control key is much easier to hit now, the meta key is also used often enough that its position on my MacBook and Apple Keyboard also deserves attention. In fact, I find that the control key is actually easier to hit, so I've remapped my control key to act as a meta key.

Binding M-<up> / M-<down> in Emacs 23.1.1

邮差的信 提交于 2019-11-26 20:27:03
I'm trying to put in a feature that I miss from Eclipse, where Alt +[ Up / Down ] transposes the lines up or down, but can not for the life of me figure out how to assign to these keys properly. I am using it in -nw mode (so just in a shell window), and typically run in a screen session. Using a global key binding, I can get it to work with letter combinations, like (kbd "M-m") , but every combination I have tried for the arrow keys just gives me a message that doesn't make sense, I always get: "ESC <up> is undefined" What I have tried: (global-set-key (kbd "M-<up>") 'transpose-line-up)

java keylistener not called

戏子无情 提交于 2019-11-26 19:02:43
I have written a sample code using KeyListener in Java, I have created a JPanel , then set its focusable to true, I have created a KeyListener, requested a focus and then added the KeyListener to my panel. But the methods for the keyListener are never called. It seems although I have requested focus, it does not focus. Can anyone help? listener = new KeyLis(); this.setFocusable(true); this.requestFocus(); this.addKeyListener(listener); class KeyLis implements KeyListener{ @Override public void keyPressed(KeyEvent e) { currentver += 5; switch (e.getKeyCode()) { case KeyEvent.VK_LEFT : if