Shortcuts for dynamically created buttons

Docking/MDI for Windows Forms Forum

Posted 18 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 18 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 (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.