Extension Functions as Keyboard Shortcuts

JasonG wrote on 3/5/2009, 11:44 AM
I'm wondering if it is possible to make functions from an extension visible to the customize toolbar or customize keyboard interface.
My extension itself shows up in both, but I'd like to be able to map a button from the extension to a keyboard shortcut.
Another option would be to create a script that runs a function in the extension (by just referencing the extension and not rewirting the code). Is that possible? I could make a script that runs the fucntion and then bind that script to a keyboard shortucut.

Comments

jetdv wrote on 3/5/2009, 12:06 PM
Extensions/Custom Commands are automatically available for both keypresses and the toolbar. You can turn that off, though, if it should not be made available to the keyboard or toolbar.

Since you say it already shows up in the keyboard shortcuts, you can simply assign it to any keypress. Then press that key and it will start.
JasonG wrote on 3/5/2009, 12:10 PM
I'm talking about functions within the extension. Imagine I have an extension with a GUI that has two buttons in it. I'd like to be able to bind the buttons to keyboard shortcuts. Currently I can only use a keyboard shortcut to launch the GUI. I'd like to have access to something like myExtension.button1.
jetdv wrote on 3/5/2009, 12:26 PM
I did that in Excalibur. I trap which button was pressed in the main routine and then call the proper "button" code from there. If you install Excalibur, you'll see Excalibur listed with a couple of sub menus. These two submenus contain all the individual tools that can be added to keypresses as well. They are all part of the main Custom Command, though. The sub menus are created by the custom command. It definitely makes things more complicated but is definitely doable.