Re: [josm-dev] Register for keys/shortcuts
Hi Folks, I'm still working on the Videomapping Plugin and it seems to work. But there is still a problem with the shortcuts: I register them by passing it to my JosmAction for the menu entry: VStart = new JosmAction(tr(play/pause), audio-playpause, tr(starts/pauses video playback), Shortcut.registerShortcut(videomapping:startstop,,KeyEvent.VK_SPACE, Shortcut.GROUP_DIRECT), false) { { But it seems that I cant register for keys like spacebar or enter? That would be very nice for a player :) regards Matthias ___ josm-dev mailing list josm-dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/josm-dev
Re: [josm-dev] Register for keys/shortcuts
On 15/09/2010 11:53, Matthias Meißer wrote: Hi Folks, I'm still working on the Videomapping Plugin and it seems to work. But there is still a problem with the shortcuts: I register them by passing it to my JosmAction for the menu entry: VStart = new JosmAction(tr(play/pause), audio-playpause, tr(starts/pauses video playback), Shortcut.registerShortcut(videomapping:startstop,,KeyEvent.VK_SPACE, Shortcut.GROUP_DIRECT), false) { { But it seems that I cant register for keys like spacebar or enter? That would be very nice for a player :) Yes, when I first wrote that I discovered that space wouldn't work. I used full-stop instead, which does. No idea why. David ___ josm-dev mailing list josm-dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/josm-dev
Re: [josm-dev] Register for keys/shortcuts
On Sun, 30 May 2010, Matthias Meißer wrote: no sry missed your mail. Your code doesn't work cause in Main (and in every published method) is no possibility to .registerActionShortcut(a, KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0)); Damn I didn't expected that such an easy thing would make so much trouble :( The question is, what do you want to do? Why don't you use a JosmAction which provides the whole framework required? The code is not designed to register keystrokes freely, as this would disable the whole keyboard assignment and handling, so it is good, that it is not so easy to register custom keys settings without the regular interface. Ciao -- http://www.dstoecker.eu/ (PGP key available)___ josm-dev mailing list josm-dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/josm-dev
Re: [josm-dev] Register for keys/shortcuts
Hi, sry it's me again with this annoying issue :( Can anybody help me with a good snippet to register Keys as JOSM plugin, please? I'm not sure if it is a problem cause I haven't got the focus as layer or if I use the wrong techniques. I tried: Main.panel.addKeyListener(this); Main.map.mapView.addKeyListener(this); Main.map.mapView.getRootPane().getGlassPane().addKeyListener(this); and of course the InputMap approach: Main.contentPane.getInputMap().put(KeyStroke.getKeyStroke(SPACE),pressed); Main.contentPane.getActionMap().put(pressed,a); Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE,0),a); Main.contentPane.getActionMap().put(doSomething,a); Sry but I'm realy annoyed cause I can't realise such a cheap feature :-( nice weekeend Matthias ___ josm-dev mailing list josm-dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/josm-dev
Re: [josm-dev] Register for keys/shortcuts
Matthias Meißer wrote: Sorry folks for my newbie questions but I doesn't get a working solution to get callbacks if somebody presses the cursor keys in the main window. main.parent.addkeyeventlistener(this); doesn't work, too :( Is there some kind of Input map or does I have to use another approach like creating an own JOSM mode? Matthias It's done countless times in JOSM source code. The direct approach would be Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT,0), actionname); Aren't you computer science student? ;) Sebastian ___ josm-dev mailing list josm-dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/josm-dev
[josm-dev] Register for keys/shortcuts
Hi, I try to register for keyevents for my plugin/layer but this doesn't seem to work :( Main.map.mapView.addKeyListener(this); Is there a good way to get notified for the cursor keys? Matthias ___ josm-dev mailing list josm-dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/josm-dev