It is possible to add shortcut keys to your module. Notice that it is very important to test and make sure that the compounded keys do not represent an existing shortcut key.
To create a shortcut, add a parameter to your button called key
where you define the different keys separated with comma, e.g. if you create a shortcut key with Control+SHIFT+L, it should look like this:
key="Control, Shift, L"
Key values must be in enum values found on this list.
If you have trouble finding correct enum value, use programme that will show which key you click found here:
D:\Git\SD.Installers\_Admin\MiscTools\KeyClicked
Keep in mind that Button Special do not support shortcut keys as they are a collection of buttons corresponding to the amount of templates in \Content.
Examples
An example can be seen below. This button inserts placeholder text to be filled out by user at a later stage. Key shortcut is Control+Shift+B:
<Button label="Insert fill" key="Control, Shift, B">
<Cmd case="BaseExtensions:content-create" type="content-control" ContentControlType="RichText" title="" tag="" text="[*]" removeOnEdit="true" PlaceCursorOutside="true" Color="yellow"/>
</Button>
The latest version of Alloy enables to use the same key twice in a shortcut. In such case, define the shortcut twice separated by a +
, like this:
key="Alt, A + Alt, A"
Sometimes, using the Alt key in shortcuts will result in Office interpreting the Alt key being pushed separately after module is executed. In these instances, it may be beneficial to include the following command in the end of your module:
<Cmd case="BaseExtensions:send-key" key="{ESC}"/>
Comments
0 comments
Article is closed for comments.