Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: AddKeyBinding for Right Parens?


This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 1 - Last Post: Oct 31, 2016 5:07 PM Last Post By: Guest
Guest
AddKeyBinding for Right Parens?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 23, 2016 9:54 AM
Using Windows 10 & Seattle, sincere thanks in advance for any advice on this!

I'm working on keybindings to emulate those I have used for years with Delphi 7 & CodeRUSH. Most are working fine. My problem: I can't bind [Shift + vk0], i.e. ")" for my parens matching expert.

This code works, and traps "0"
BindingServices.AddKeyBinding([ShortCut(vk0,[])], myParensExpert, nil);

These variations do not work to trap a ")" keystroke:
BindingServices.AddKeyBinding([ShortCut(vk0,[ssShift])], myParensExpert, nil);
BindingServices.AddKeyBinding([ShortCut(vk0,[])], myParensExpert, nil, kfImplicitShift,'','');
nor do many others I've tried using various combinations of TKeyBindingFlags and forms of TShortcut. The keypress is not processed by BindingServices.

It seems this holds true for any of the shifted upper-row keys [`..=]. It seems I can bind to any without shift state, but not with shift state, i.e. I can't bind to any of these keystrokes: ~!@#$%^&*()_+

I have tried using a global hotkey utility to map "Shift+VK0", and it works (even in Delphi), so I'm fairly sure it's not an OS issue.

Can anyone help with a solution or workaround?
Guest
Re: AddKeyBinding for Right Parens?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 31, 2016 5:07 PM   in response to: Guest in response to: Guest
Monte Etherton wrote:
Using Windows 10 & Seattle, sincere thanks in advance for any advice on this!

I'm working on keybindings to emulate those I have used for years with Delphi 7 & CodeRUSH. Most are working fine. My problem: I can't bind [Shift + vk0], i.e. ")" for my parens matching expert.

This code works, and traps "0"
BindingServices.AddKeyBinding([ShortCut(vk0,[])], myParensExpert, nil);

These variations do not work to trap a ")" keystroke:
BindingServices.AddKeyBinding([ShortCut(vk0,[ssShift])], myParensExpert, nil);
BindingServices.AddKeyBinding([ShortCut(vk0,[])], myParensExpert, nil, kfImplicitShift,'','');
nor do many others I've tried using various combinations of TKeyBindingFlags and forms of TShortcut. The keypress is not processed by BindingServices.

It seems this holds true for any of the shifted upper-row keys [`..=]. It seems I can bind to any without shift state, but not with shift state, i.e. I can't bind to any of these keystrokes: ~!@#$%^&*()_+

I have tried using a global hotkey utility to map "Shift+VK0", and it works (even in Delphi), so I'm fairly sure it's not an OS issue.

Can anyone help with a solution or workaround?

Thanks to Roy at DTS, this worked for me:

BindingServices.AddKeyBinding([Ord(')')],ParenthTest,nil,kfLiteralChar);
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02