Shortcuts for dynamically created buttons

Docking/MDI for Windows Forms Forum

Posted 15 years ago by Kasper
Avatar
Hi,

I'm allowing my users to create a number of buttons which can do various things like inserting a piece of code, execute a file etc. This works just fine, but now that I wish to allow the user to define shortcuts for these buttons, I seem to be having some problems. I'm doing it by creating a new BarButtonCommand, and then assigning the shortcut like this:

barButton.KeyboardShortcuts.Add(new BarKeyboardShortcut(null, button.ChordKey, button.ShortcutKey));

It appears to work, since the shortcut is displayed correctly in the tooltip of the button, but when I press the shortcut, nothing happens - the CommandClick event is not triggered like it is with the non-dynamically created buttons. Am I missing something obvious here? :)

Comments (1)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Is your command in the BarManager.Commands collection? That might cause this behavior if it is not. If it is, then please send over a simple repro project or post some lines that we can add to our test app to duplicate it.


Actipro Software Support

The latest build of this product (v21.1.1) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.