Login  Register

Re: Fn Shortcut keys requires control key, they should not

Posted by Stein Rørvik on Jan 06, 2018; 1:13am
URL: http://imagej.273.s1.nabble.com/Fn-Shortcut-keys-requires-control-key-they-should-not-tp5019772p5019834.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