Posted 18 years ago
by Kasper
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? :)
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? :)