Problem setting keyboard shortcut for Command in C# add-in

Daniel R. shared this question 4 months ago
Answered

Hello!

I am currently developing a C# add-in for the 2021 version and I can't seem to be able to set or use a keyboard shortcut for my new command.

I follow the documentation exactly, but no luck
49263977b6c8125fbc612725273bbf40


Even the sample macro code available in the docs does not seem to work... am I missing something simple? what does a "R" as the shortcut mean actually for the user?

Thank you :)

Best Answer
photo

Hello Daniel

The context for this is setting a shortcut for a button or tab, and defining the caption for the button or tab. They are not shortcuts at the Windows level. When you press the Alt key in MindManager you can preview the shortcut keys for each tab in the ribbon. When you press a key for a tab, you can then see the shortcut keys for each button. If there is a button called "Report" in the tab, then the example code would have caused "R" to be previewed as the shortcut, and pressing R will raise the click event. If the parent tab had (for example) the shortcut key "Y" then pressing Alt,Y,R would run this command.

These shortcuts may be a single character or compound (multiple keys) provided that they are unique within the tab. This can only be done from an Add-in because if you create buttons or tabs in a macro, they go out of scope as soon as the macro stops running. For C# you will need to use (char)10 instead of vbLf.

Replies (2)

photo
2

Hello Daniel

The context for this is setting a shortcut for a button or tab, and defining the caption for the button or tab. They are not shortcuts at the Windows level. When you press the Alt key in MindManager you can preview the shortcut keys for each tab in the ribbon. When you press a key for a tab, you can then see the shortcut keys for each button. If there is a button called "Report" in the tab, then the example code would have caused "R" to be previewed as the shortcut, and pressing R will raise the click event. If the parent tab had (for example) the shortcut key "Y" then pressing Alt,Y,R would run this command.

These shortcuts may be a single character or compound (multiple keys) provided that they are unique within the tab. This can only be done from an Add-in because if you create buttons or tabs in a macro, they go out of scope as soon as the macro stops running. For C# you will need to use (char)10 instead of vbLf.

photo
1

Thank you so much for explaining the meaning of "keyboard shortcuts" within MindManager (Alt key as a starter), it makes all the rest very clear and I can now see how all the builtin commands follow the alt, <Ribbon key>, <Command key> pattern. Pretty unintuitive on Windows (would've loved a classic Ctrl+<key> or something, pressing both at the same time rather than sequentially) but hey, at least there is something.

Not directly related, but would you know the link to the 2021 version Documentation? googling I could only find the 2020 API and then after a lot of sleuthing I found the 2022, but no luck for our current version.

Thanks so much!

photo
2

Hello Daniel

The COM API documentation was not fully re-published at MindManager 21. Sometimes the changes in the API between versions do not affect third party Add-ins very much. However if you go to the appendices in the MindManager 22 version, there is a section (albeit with the wrong title in the contents pane!) detailing the differences from MindManager 2020 to 21:

https://www.mindmanager.com/en/pages/developers/api/22/#AppendicesChanges20to21.html

Generally, almost nothing actually gets removed from the API at new releases, but some items may be marked as deprecated. Everything in the MindManager 20 API will still work on 21.

---