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.
|