Hello,
There is an option "Require control key for shortcuts" which is very useful for controlling the behaviour of the alphanumeric keys. This does not apply for macros, so you can for example define "my macro [p]" which launches when you press the key 'p' and "another macro [P]" which launches when you press the key shift 'P'. If you have the "Require control key for shortcuts" setting turned on, this will not conflict with the Print and Properties... commands; which then launches when you press control-p and control-shift-P respectively. This is good and flexible behaviour, as the "Require control key for shortcuts" setting thus enables many more possibilities for keyboard shortcuts. The problem I want to address is that in order to launch macros that uses F-keys as shortcuts, you must press the control key to access them if the "Require control key for shortcuts" is enabled. So "my macro [F2]" require you to press control-F2 to launch it. I think that is both unnecessary (as no F-key shortcuts are defined in the existing menus) and inconsistent (as the other macro shortcuts run without requiring the control key). Can this behaviour be changed so that the F-key macros launch independently of the "Require control key for shortcuts" setting? If the F-key shortcut macros launched independently of the modifier key settings, you could even use isKeyDown("shift"/"alt"/"space") to modify its behaviour inside the macro. For the numeric pad, whether or not the given macro shortcut key requires a control press varies from key to key. The + and - keys work without control, but not * or / or any of the number keys. This is quite inconsistent behaviour. The numeric period does not work at all for me but that could be a keyboard issue since I am in Europe and the period key maps to comma by default here. Here is a test macro to illustrate the current behaviour: macro "F1 [f1]" {print("F1");} //requires ctrl macro "Numeric Pad 0 [n0]" { print("npad 0"); } //requires ctrl macro "Numeric Pad 9 [n9]" { print("npad 9"); } //requires ctrl macro "Numeric Pad / [n/]" { print("npad /"); } //requires ctrl macro "Numeric Pad * [n*]" { print("npad *"); } //requires ctrl macro "Numeric Pad - [n-]" { print("npad -"); } //ok macro "Numeric Pad + [n+]" { print("npad +"); } //ok macro "Numeric Pad . [n.]" { print("npad ."); } //does not work at all I am using daily build ImageJ 1.51s with Java 1.6 on Windows 7/64-bit. I don't know if this behaviour happens on Linux and MacOS too? Is this a bug or a limitation of the way the keyboard is mapped in Windows? Stein -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
> On Dec 20, 2017, at 4:01 AM, Stein Rørvik <[hidden email]> wrote:
> > Hello, > > There is an option "Require control key for shortcuts" which is very useful for controlling the behaviour of the alphanumeric keys. > This does not apply for macros, so you can for example define "my macro [p]" which launches when you press the key 'p' and "another macro [P]" which launches when you press the key shift 'P'. If you have the "Require control key for shortcuts" setting turned on, this will not conflict with the Print and Properties... commands; which then launches when you press control-p and control-shift-P respectively. This is good and flexible behaviour, as the "Require control key for shortcuts" setting thus enables many more possibilities for keyboard shortcuts. > > The problem I want to address is that in order to launch macros that uses F-keys as shortcuts, you must press the control key to access them if the "Require control key for shortcuts" is enabled. So "my macro [F2]" require you to press control-F2 to launch it. I think that is both unnecessary (as no F-key shortcuts are defined in the existing menus) and inconsistent (as the other macro shortcuts run without requiring the control key). Can this behaviour be changed so that the F-key macros launch independently of the "Require control key for shortcuts" setting? If the F-key shortcut macros launched independently of the modifier key settings, you could even use isKeyDown("shift"/"alt"/"space") to modify its behaviour inside the macro. > > For the numeric pad, whether or not the given macro shortcut key requires a control press varies from key to key. The + and - keys work without control, but not * or / or any of the number keys. This is quite inconsistent behaviour. The numeric period does not work at all for me but that could be a keyboard issue since I am in Europe and the period key maps to comma by default here. In the latest ImageJ daily build (1.51t19), function key and numeric keypad macro shortcuts should work as expected when "Require control key for shortcuts” is enabled. The numeric keypad period key problem is not fixed. -wayne > Here is a test macro to illustrate the current behaviour: > > macro "F1 [f1]" {print("F1");} //requires ctrl > macro "Numeric Pad 0 [n0]" { print("npad 0"); } //requires ctrl > macro "Numeric Pad 9 [n9]" { print("npad 9"); } //requires ctrl > macro "Numeric Pad / [n/]" { print("npad /"); } //requires ctrl > macro "Numeric Pad * [n*]" { print("npad *"); } //requires ctrl > macro "Numeric Pad - [n-]" { print("npad -"); } //ok > macro "Numeric Pad + [n+]" { print("npad +"); } //ok > macro "Numeric Pad . [n.]" { print("npad ."); } //does not work at all > > I am using daily build ImageJ 1.51s with Java 1.6 on Windows 7/64-bit. > I don't know if this behaviour happens on Linux and MacOS too? > Is this a bug or a limitation of the way the keyboard is mapped in Windows? > > Stein > > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Thank you Wayne for this fix; it works as intended.
Regarding the fact that I could not get the numpad '.' shortcut to work at all: I can now confirm that this is a regional keyboard issue. I tested the macro in our CT lab where the PC has an UK keyboard and there the shortcut works, but only with the control key down. Perhaps you should apply whatever change you did to get the numpad '/' and '*' keys to work to the numpad '.' as well, for consistency? I assume this problem will apply to US keyboard users as well. Or is there any other compatibility related reason you did not apply the fix to the numpad '.' key? Stein -----Original Message----- From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Wayne Rasband Sent: 28. desember 2017 18:20 To: [hidden email] Subject: Re: Fn Shortcut keys requires control key, they should not > On Dec 20, 2017, at 4:01 AM, Stein Rørvik <[hidden email]> wrote: > ... > > For the numeric pad, whether or not the given macro shortcut key requires a control press varies from key to key. The + and - keys work without control, but not * or / or any of the number keys. This is quite inconsistent behaviour. The numeric period does not work at all for me but that could be a keyboard issue since I am in Europe and the period key maps to comma by default here. In the latest ImageJ daily build (1.51t19), function key and numeric keypad macro shortcuts should work as expected when "Require control key for shortcuts” is enabled. The numeric keypad period key problem is not fixed. -wayne > Here is a test macro to illustrate the current behaviour: > > macro "F1 [f1]" {print("F1");} //requires ctrl > macro "Numeric Pad 0 [n0]" { print("npad 0"); } //requires ctrl > macro "Numeric Pad 9 [n9]" { print("npad 9"); } //requires ctrl > macro "Numeric Pad / [n/]" { print("npad /"); } //requires ctrl > macro "Numeric Pad * [n*]" { print("npad *"); } //requires ctrl > macro "Numeric Pad - [n-]" { print("npad -"); } //ok > macro "Numeric Pad + [n+]" { print("npad +"); } //ok > macro "Numeric Pad . [n.]" { print("npad ."); } //does not work at all > > I am using daily build ImageJ 1.51s with Java 1.6 on Windows 7/64-bit. > I don't know if this behaviour happens on Linux and MacOS too? > Is this a bug or a limitation of the way the keyboard is mapped in Windows? > > Stein > > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Stein, Wayne, and everyone,
just for information: On my German keyboard, the Numpad-, key (which is at the position of the Numpad-. of English/US keyboards) sends key code 109=VK_SEPARATOR. For English/US keyboards, it is 110=VK_DECIMAL. (In ImageJ, one can easily check with Edit>Options>Misc>Debug Mode). Yes, it would be nice to map the VK_SEPARATOR to VK_DECIMAL... --- By the way, speaking of shortcuts, a long-time wish of mine is having the Delete (delete-right, VK_DELETE=127) for TextPanels (maybe also for images) working like the backspace (delete-left, VK_BACK_SPACE=8). In non-Mac environments, one gets used to using the Delete(right) key for deleting. The backspace is often reserved to text. So I always try to use the delete-right for deleting lines in the Log, ResultsTables, etc. (the code is in ImageJ.java:480) Michael ________________________________________________________________ On 04/01/2018 14:27, Stein Rørvik wrote: > Thank you Wayne for this fix; it works as intended. > > Regarding the fact that I could not get the numpad '.' shortcut to work at all: I can now confirm that this is a regional keyboard issue. I tested the macro in our CT lab where the PC has an UK keyboard and there the shortcut works, but only with the control key down. Perhaps you should apply whatever change you did to get the numpad '/' and '*' keys to work to the numpad '.' as well, for consistency? I assume this problem will apply to US keyboard users as well. Or is there any other compatibility related reason you did not apply the fix to the numpad '.' key? > > Stein > > -----Original Message----- > From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Wayne Rasband > Sent: 28. desember 2017 18:20 > To: [hidden email] > Subject: Re: Fn Shortcut keys requires control key, they should not > >> On Dec 20, 2017, at 4:01 AM, Stein Rørvik <[hidden email]> wrote: >> > ... >> >> For the numeric pad, whether or not the given macro shortcut key requires a control press varies from key to key. The + and - keys work without control, but not * or / or any of the number keys. This is quite inconsistent behaviour. The numeric period does not work at all for me but that could be a keyboard issue since I am in Europe and the period key maps to comma by default here. > > In the latest ImageJ daily build (1.51t19), function key and numeric keypad macro shortcuts should work as expected when "Require control key for shortcuts” is enabled. The numeric keypad period key problem is not fixed. > > -wayne > >> Here is a test macro to illustrate the current behaviour: >> >> macro "F1 [f1]" {print("F1");} //requires ctrl >> macro "Numeric Pad 0 [n0]" { print("npad 0"); } //requires ctrl >> macro "Numeric Pad 9 [n9]" { print("npad 9"); } //requires ctrl >> macro "Numeric Pad / [n/]" { print("npad /"); } //requires ctrl >> macro "Numeric Pad * [n*]" { print("npad *"); } //requires ctrl >> macro "Numeric Pad - [n-]" { print("npad -"); } //ok >> macro "Numeric Pad + [n+]" { print("npad +"); } //ok >> macro "Numeric Pad . [n.]" { print("npad ."); } //does not work at all >> >> I am using daily build ImageJ 1.51s with Java 1.6 on Windows 7/64-bit. >> I don't know if this behaviour happens on Linux and MacOS too? >> Is this a bug or a limitation of the way the keyboard is mapped in Windows? >> >> Stein >> >> >> -- >> ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
If you are on Windows, there are several ways to remap the scancodes generated by the keyboard as you like; either by using a key remapping utility or by editing the registry.
Here is an example: Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout] "Scancode Map"=hex:\ 00,00,00,00,\ 00,00,00,00,\ 03,00,00,00,\ 34,00,53,00,\ ; Remap Numeric decimal key to Period 5d,e0,1d,e0,\ ; Remap Right Ctrl key to Menu key 00,00,00,00 Here is some documentation: https://www.experts-exchange.com/articles/2155/Keyboard-Remapping-CAPSLOCK-to-Ctrl-and-Beyond.html You need to reboot after importing the script to apply the change, which of course is permament and goes across all applications. A key remapping utility can probably be configured to work only for specific applications. Of course, this can both break ImageJ shortcuts, or enable shortcuts that are unavailable because the scancodes in question are unavaliable on your current layout. You could try applying 6E,00, 6D,00,\ ; Remap VK_SEPARATOR to VK_DECIMAL 08,00, 7F,00,\ ; Remap VK_DELETE to VK_BACK_SPACE in the above script to achieve your desired remapping ? Back to the topic of ImageJ shortcuts, the ideal would be if the macros could use hex scancodes as shortcuts directly, such as macro "My Macro [#46]" to take use of the otherwise nearly useless (and mostly retired) scroll-lock key; or "My Macro [#E019]" to take use of the next-track media key found on nearly all keyboards nowadays? Stein -----Original Message----- From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Michael Schmid Sent: 05. januar 2018 16:13 To: [hidden email] Subject: Re: Fn Shortcut keys requires control key, they should not Hi Stein, Wayne, and everyone, just for information: On my German keyboard, the Numpad-, key (which is at the position of the Numpad-. of English/US keyboards) sends key code 109=VK_SEPARATOR. For English/US keyboards, it is 110=VK_DECIMAL. (In ImageJ, one can easily check with Edit>Options>Misc>Debug Mode). Yes, it would be nice to map the VK_SEPARATOR to VK_DECIMAL... --- By the way, speaking of shortcuts, a long-time wish of mine is having the Delete (delete-right, VK_DELETE=127) for TextPanels (maybe also for images) working like the backspace (delete-left, VK_BACK_SPACE=8). In non-Mac environments, one gets used to using the Delete(right) key for deleting. The backspace is often reserved to text. So I always try to use the delete-right for deleting lines in the Log, ResultsTables, etc. (the code is in ImageJ.java:480) Michael ________________________________________________________________ On 04/01/2018 14:27, Stein Rørvik wrote: > Thank you Wayne for this fix; it works as intended. > > Regarding the fact that I could not get the numpad '.' shortcut to work at all: I can now confirm that this is a regional keyboard issue. I tested the macro in our CT lab where the PC has an UK keyboard and there the shortcut works, but only with the control key down. Perhaps you should apply whatever change you did to get the numpad '/' and '*' keys to work to the numpad '.' as well, for consistency? I assume this problem will apply to US keyboard users as well. Or is there any other compatibility related reason you did not apply the fix to the numpad '.' key? > > Stein > > -----Original Message----- > From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of > Wayne Rasband > Sent: 28. desember 2017 18:20 > To: [hidden email] > Subject: Re: Fn Shortcut keys requires control key, they should not > >> On Dec 20, 2017, at 4:01 AM, Stein Rørvik <[hidden email]> wrote: >> > ... >> >> For the numeric pad, whether or not the given macro shortcut key requires a control press varies from key to key. The + and - keys work without control, but not * or / or any of the number keys. This is quite inconsistent behaviour. The numeric period does not work at all for me but that could be a keyboard issue since I am in Europe and the period key maps to comma by default here. > > In the latest ImageJ daily build (1.51t19), function key and numeric keypad macro shortcuts should work as expected when "Require control key for shortcuts” is enabled. The numeric keypad period key problem is not fixed. > > -wayne > >> Here is a test macro to illustrate the current behaviour: >> >> macro "F1 [f1]" {print("F1");} //requires ctrl >> macro "Numeric Pad 0 [n0]" { print("npad 0"); } //requires ctrl >> macro "Numeric Pad 9 [n9]" { print("npad 9"); } //requires ctrl >> macro "Numeric Pad / [n/]" { print("npad /"); } //requires ctrl >> macro "Numeric Pad * [n*]" { print("npad *"); } //requires ctrl >> macro "Numeric Pad - [n-]" { print("npad -"); } //ok >> macro "Numeric Pad + [n+]" { print("npad +"); } //ok >> macro "Numeric Pad . [n.]" { print("npad ."); } //does not work at >> all >> >> I am using daily build ImageJ 1.51s with Java 1.6 on Windows 7/64-bit. >> I don't know if this behaviour happens on Linux and MacOS too? >> Is this a bug or a limitation of the way the keyboard is mapped in Windows? >> >> Stein >> >> >> -- >> ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Michael Schmid
> On Jan 5, 2018, at 10:12 AM, Michael Schmid <[hidden email]> wrote:
> > Hi Stein, Wayne, and everyone, > > just for information: > On my German keyboard, the Numpad-, key (which is at the position of the Numpad-. of English/US keyboards) sends key code 109=VK_SEPARATOR. For English/US keyboards, it is 110=VK_DECIMAL. > (In ImageJ, one can easily check with Edit>Options>Misc>Debug Mode). > > Yes, it would be nice to map the VK_SEPARATOR to VK_DECIMAL… In the latest daily build (1.51u5), the VK_SEPARATOR key (‘,’) is mapped to VK_DECIMAL (‘.’) and you do not have to hold down the control key when using the numeric keypad '.’ macro shortcut when the “Require control key for shortcuts” option is enabled. > By the way, speaking of shortcuts, a long-time wish of mine is having the Delete (delete-right, VK_DELETE=127) for TextPanels (maybe also for images) working like the backspace (delete-left, VK_BACK_SPACE=8). > > In non-Mac environments, one gets used to using the Delete(right) key for deleting. The backspace is often reserved to text. So I always try to use the delete-right for deleting lines in the Log, ResultsTables, etc. > (the code is in ImageJ.java:480) In the daily build, the delete key (VK_DELETE) can be used as a substitute for backspace as the shortcut for the Image>Clear command and for deleting lines in Results Tables and in the Log window. -wayne > ________________________________________________________________ > On 04/01/2018 14:27, Stein Rørvik wrote: >> Thank you Wayne for this fix; it works as intended. >> Regarding the fact that I could not get the numpad '.' shortcut to work at all: I can now confirm that this is a regional keyboard issue. I tested the macro in our CT lab where the PC has an UK keyboard and there the shortcut works, but only with the control key down. Perhaps you should apply whatever change you did to get the numpad '/' and '*' keys to work to the numpad '.' as well, for consistency? I assume this problem will apply to US keyboard users as well. Or is there any other compatibility related reason you did not apply the fix to the numpad '.' key? >> Stein >> -----Original Message----- >> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Wayne Rasband >> Sent: 28. desember 2017 18:20 >> To: [hidden email] >> Subject: Re: Fn Shortcut keys requires control key, they should not >>> On Dec 20, 2017, at 4:01 AM, Stein Rørvik <[hidden email]> wrote: >>> >> ... >>> >>> For the numeric pad, whether or not the given macro shortcut key requires a control press varies from key to key. The + and - keys work without control, but not * or / or any of the number keys. This is quite inconsistent behaviour. The numeric period does not work at all for me but that could be a keyboard issue since I am in Europe and the period key maps to comma by default here. >> In the latest ImageJ daily build (1.51t19), function key and numeric keypad macro shortcuts should work as expected when "Require control key for shortcuts” is enabled. The numeric keypad period key problem is not fixed. >> -wayne >>> Here is a test macro to illustrate the current behaviour: >>> >>> macro "F1 [f1]" {print("F1");} //requires ctrl >>> macro "Numeric Pad 0 [n0]" { print("npad 0"); } //requires ctrl >>> macro "Numeric Pad 9 [n9]" { print("npad 9"); } //requires ctrl >>> macro "Numeric Pad / [n/]" { print("npad /"); } //requires ctrl >>> macro "Numeric Pad * [n*]" { print("npad *"); } //requires ctrl >>> macro "Numeric Pad - [n-]" { print("npad -"); } //ok >>> macro "Numeric Pad + [n+]" { print("npad +"); } //ok >>> macro "Numeric Pad . [n.]" { print("npad ."); } //does not work at all >>> >>> I am using daily build ImageJ 1.51s with Java 1.6 on Windows 7/64-bit. >>> I don't know if this behaviour happens on Linux and MacOS too? >>> Is this a bug or a limitation of the way the keyboard is mapped in Windows? >>> >>> Stein -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Thank you Wayne,
the numeric decimal key macro shortcut now works as expected also on my Norwegian keyboard. Stein -----Original Message----- From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Wayne Rasband Sent: 6. januar 2018 02:28 To: [hidden email] Subject: Re: Fn Shortcut keys requires control key, they should not > On Jan 5, 2018, at 10:12 AM, Michael Schmid <[hidden email]> wrote: > > Hi Stein, Wayne, and everyone, > > just for information: > On my German keyboard, the Numpad-, key (which is at the position of the Numpad-. of English/US keyboards) sends key code 109=VK_SEPARATOR. For English/US keyboards, it is 110=VK_DECIMAL. > (In ImageJ, one can easily check with Edit>Options>Misc>Debug Mode). > > Yes, it would be nice to map the VK_SEPARATOR to VK_DECIMAL… In the latest daily build (1.51u5), the VK_SEPARATOR key (‘,’) is mapped to VK_DECIMAL (‘.’) and you do not have to hold down the control key when using the numeric keypad '.’ macro shortcut when the “Require control key for shortcuts” option is enabled. > By the way, speaking of shortcuts, a long-time wish of mine is having the Delete (delete-right, VK_DELETE=127) for TextPanels (maybe also for images) working like the backspace (delete-left, VK_BACK_SPACE=8). > > In non-Mac environments, one gets used to using the Delete(right) key for deleting. The backspace is often reserved to text. So I always try to use the delete-right for deleting lines in the Log, ResultsTables, etc. > (the code is in ImageJ.java:480) In the daily build, the delete key (VK_DELETE) can be used as a substitute for backspace as the shortcut for the Image>Clear command and for deleting lines in Results Tables and in the Log window. -wayne > ________________________________________________________________ > On 04/01/2018 14:27, Stein Rørvik wrote: >> Thank you Wayne for this fix; it works as intended. >> Regarding the fact that I could not get the numpad '.' shortcut to work at all: I can now confirm that this is a regional keyboard issue. I tested the macro in our CT lab where the PC has an UK keyboard and there the shortcut works, but only with the control key down. Perhaps you should apply whatever change you did to get the numpad '/' and '*' keys to work to the numpad '.' as well, for consistency? I assume this problem will apply to US keyboard users as well. Or is there any other compatibility related reason you did not apply the fix to the numpad '.' key? >> Stein >> -----Original Message----- >> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Wayne Rasband >> Sent: 28. desember 2017 18:20 >> To: [hidden email] >> Subject: Re: Fn Shortcut keys requires control key, they should not >>> On Dec 20, 2017, at 4:01 AM, Stein Rørvik <[hidden email]> wrote: >>> >> ... >>> >>> For the numeric pad, whether or not the given macro shortcut key requires a control press varies from key to key. The + and - keys work without control, but not * or / or any of the number keys. This is quite inconsistent behaviour. The numeric period does not work at all for me but that could be a keyboard issue since I am in Europe and the period key maps to comma by default here. >> In the latest ImageJ daily build (1.51t19), function key and numeric keypad macro shortcuts should work as expected when "Require control key for shortcuts” is enabled. The numeric keypad period key problem is not fixed. >> -wayne >>> Here is a test macro to illustrate the current behaviour: >>> >>> macro "F1 [f1]" {print("F1");} //requires ctrl >>> macro "Numeric Pad 0 [n0]" { print("npad 0"); } //requires ctrl >>> macro "Numeric Pad 9 [n9]" { print("npad 9"); } //requires ctrl >>> macro "Numeric Pad / [n/]" { print("npad /"); } //requires ctrl >>> macro "Numeric Pad * [n*]" { print("npad *"); } //requires ctrl >>> macro "Numeric Pad - [n-]" { print("npad -"); } //ok >>> macro "Numeric Pad + [n+]" { print("npad +"); } //ok >>> macro "Numeric Pad . [n.]" { print("npad ."); } //does not work at all >>> >>> I am using daily build ImageJ 1.51s with Java 1.6 on Windows 7/64-bit. >>> I don't know if this behaviour happens on Linux and MacOS too? >>> Is this a bug or a limitation of the way the keyboard is mapped in Windows? >>> >>> Stein -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |