Print Page | Close Window

Disabling certain shortcut keys

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=1748
Printed Date: 16 November 2024 at 12:59pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Disabling certain shortcut keys
Posted By: Marek
Subject: Disabling certain shortcut keys
Date Posted: 03 February 2005 at 1:42pm

Hi,

Is there a way to disable a set of characters to be used as shortcut keys? ie if a user selects one of the forbidden shortcut keys in the Customization Dialog, a warning would appear and the key would be disallowed?

Thanks.

-m




Replies:
Posted By: SuperMario
Date Posted: 03 February 2005 at 1:44pm
I suppose you could add a key binding for all disallowed key to an ID, and in the commandbars_execute event you can use this Id to display you message.


Posted By: Boyd
Date Posted: 03 February 2005 at 3:14pm

I've actually spent at lot of time looking into this, and there is no solution.

A simple scenario is using Ctrl+C for the Copy command.  This is a shortcut that is used by many controls in an application, and it'd be crazy to assign this to a CommandBarControl because it's almost impossible to figure out which of the many controls on the screen should have the copy command applied to it.  The real problem is with customization.  If a user goes and customizes the Ctrl+C shortcut, you've just lost the built-in copy functionality from all your controls (since CommandBars will steal the command from everything in your app).

The easy workaround would be for Codejock to update the customization procedures to either allow you to specificy shortcuts that cannot be used to customize OR at least expose an event you can respond to before a key binding is added that would allow you to cancel the assignment.

Way back on Sept 16, 2004, I submitted an item to Codejock title "More Properties/Methods for CommandBars KeyBindings" (Issue #1713).  The following summarizes that request:

Request: The Xtreme Suite for ActiveX CommandBars object only allows you to programatically add keybindings. I would like to see more properties and method available to the programmer for use with keybindings:

1) Method to Delete KeyBinding from a Command
2) Property to determine which Command is bound to a key
3) Ability to enumerate all configured KeyBindings

Since I allow users to customize toolbars, I have no way of knowing what KeyBindings they have created. Because I reserve certain shortcut keys (like F1), I also need to be able to prevent the user from binding certain keys to a command. Can you add a ''BeforeAddKeyBidning'' event to CommandBars that allows the programmer to cancel a particular keybinding request. This would allow me to detect that the user tried to bind F1 to a command so I could refuse the new key binding and prompt them for the reason why.

I''ve requested this feature in the past, but I''ve never really heard anything about it. I''d appreciate it if someone could comment on the possibility of incorporating this into the CommandBars product.

Keep up the great work!!

Unfortunately, it's now been 5 months and I've received absolutely no response .  This is one of 10 items I've posted and never received any feedback on whatsoever.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net