Does anyone know of a way to use the space bar as a hot key for a macro.
For instance, I currently have it set so that hitting 'a' marks a location on the image. Is there a way that I could achieve the same effect by hitting 'space bar'? If there is not, does anyone know how I can go about adding this as a feature request? Thank you. - Trotter Cashion Nathan Kline Institute for Psychiatric Research [hidden email] |
I've use this to wait until I hit the space bar. Is that what you wanted?
while (isKeyDown("space") < 1) { } M At 02:39 PM 3/8/2006, you wrote: >Does anyone know of a way to use the space bar as a hot key for a macro. >For instance, I currently have it set so that hitting 'a' marks a location >on the image. Is there a way that I could achieve the same effect by >hitting 'space bar'? If there is not, does anyone know how I can go about >adding this as a feature request? Thank you. > >- Trotter Cashion >Nathan Kline Institute for Psychiatric Research >[hidden email] |
Thanks Martin, but this isn't exactly what I'm looking for. I need to be
able to run other macros (using hotkeys) while waiting for the space bar to be hit, and this solution would prohibit me from doing so. Thanks anyway though. - Trotter On 3/8/06, Martin du Saire <[hidden email]> wrote: > > I've use this to wait until I hit the space bar. Is that what you wanted? > > while (isKeyDown("space") < 1) { > } > > M > > At 02:39 PM 3/8/2006, you wrote: > >Does anyone know of a way to use the space bar as a hot key for a macro. > >For instance, I currently have it set so that hitting 'a' marks a > location > >on the image. Is there a way that I could achieve the same effect by > >hitting 'space bar'? If there is not, does anyone know how I can go > about > >adding this as a feature request? Thank you. > > > >- Trotter Cashion > >Nathan Kline Institute for Psychiatric Research > >[hidden email] > |
In reply to this post by Trotter Cashion
why not write a plug-in with a custom event listener?
e.g. ////////// public class do_my_thing_ implements PlugIn, KeyListener { //...setup_and_stuff public void keyPressed(KeyEvent e) { int keyCode = e.getKeyCode(); switch(keyCode) { case(32)://do_my_spacebar_thing // case(other_key_codes_that_you_might_want_to_trap) // ... default:break; } } } ////////// I've never done it, quite, like this -- overriding the main program's built in key-trapping directly; I have made it work by putting the KeyListener (and mouse listeners, &c.) into a customCanvass class, on more than one occasion (I wanted to draw a non-destructive overlay based on user input), but it *should* work. I don't have a lot of experience with the macro interface; I do most of my work with ImageJ directly via java, like above -- so I'm not sure how macros and a plug-in like this would interface, but - I would expect - that you could run the plug-in first (to add your custom event handlers), and the macros after, with the event handlers becoming a persistent part of the image, as far as ImageJ was concerned. There's a pretty good [complete, working] example of how to implement a KeyListener on the plugins page ( http://rsb.info.nih.gov/ij/plugins/key-listener.html ) that was thrown up there by Wayne Rasband, back in 2000. -Gabriel DeBarr -----Original Message----- From: ImageJ Interest Group [mailto:[hidden email]]On Behalf Of Trotter Cashion Sent: Wednesday, March 08, 2006 4:52 PM To: [hidden email] Subject: Re: Space Bar as Macro Hotkey Thanks Martin, but this isn't exactly what I'm looking for. I need to be able to run other macros (using hotkeys) while waiting for the space bar to be hit, and this solution would prohibit me from doing so. Thanks anyway though. - Trotter On 3/8/06, Martin du Saire <[hidden email]> wrote: > > I've use this to wait until I hit the space bar. Is that what you wanted? > > while (isKeyDown("space") < 1) { > } > > M > > At 02:39 PM 3/8/2006, you wrote: > >Does anyone know of a way to use the space bar as a hot key for a macro. > >For instance, I currently have it set so that hitting 'a' marks a > location > >on the image. Is there a way that I could achieve the same effect by > >hitting 'space bar'? If there is not, does anyone know how I can go > about > >adding this as a feature request? Thank you. > > > >- Trotter Cashion > >Nathan Kline Institute for Psychiatric Research > >[hidden email] > **************************************************************************************** Note: If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you. **************************************************************************************** |
In reply to this post by Trotter Cashion
> Does anyone know of a way to use the space bar as a hot key
> for a macro. For instance, I currently have it set so that > hitting 'a' marks a location on the image. Is there a way > that I could achieve the same effect by hitting 'space bar'? > If there is not, does anyone know how I can go about adding > this as a feature request? Thank you. There is a potential conflict with using the space bar for macro keyboard shortcuts. It is used as a shortcut for selecting the 'hand' (scrolling) tool. Have you considered using the "0" key on the numeric keypad? More information about macro keyboard shortcuts can be found at http://rsb.info.nih.gov/ij/developer/macro/macros.html#shortcuts -wayne > |
Free forum by Nabble | Edit this page |