I’m building a plugin that will launch a WPF window with a keystroke and I would like to understand the best approach for doing this in Rhino. Questions include:
Is there a recommended way to coordinate an event with existing user preferences and keystroke shortcuts so that the keystroke won’t conflict with a user’s preference, etc.?
Is there a recommended way to prevent keystrokes that relate to an event from appearing on the command-line as command-line command suggestions?
The best practice is to avoid hooking the Windows keyboard when possible and just use Rhino’s keyboard handling features when possible.
For example, if you need a shortcut to run a command, you can do so programatically:
var macro = ShortcutKeySettings.GetMacro(ShortcutKey.CtrlF12);
if (string.IsNullOrEmpty(macro))
ShortcutKeySettings.SetMacro(ShortcutKey.CtrlF12, "! _ShowMyWpfForm");
Is it possible to programmatically define a new key sequence for the above suggestion? (ie. I don’t really like the options currently defined by ShortcutKey)
If I understand the method correctly it binds the “EnglishName” of a command to a keystroke. Is this correct?
Thanks. So I need to learn about keyboard hooks … super, I’m always happy to learn something new!
By chance are there any c# examples for defining and using a keyboard hook in Rhino?
Dale - a post reply note - I’ve hacked together something with a keyboard event that’s doing the trick and can live without an example but if one is ever made please let me know, I’d be really happy to take a look.