Michael M?ller
Guest
|
using:
VS 2013
Word 2003 with SP3 (11.8411.8405) German
Add-in Express for Office and .NET, Standard 9.2.4635
In my project I added several buttons to the adxCommandBarPopups for "&Datei"(file) and "&Einf?gen"(insert) in the adxMainMenu with CommandBarName "Menu Bar" for word. I defined some new adxKeyboardShortcuts and most of them are working fine. Those which starts with <Alt> don't work even those which are defined by word. I set the HandleShortcut property to true.
To check if those adxKeyboardShortcuts are recognized, I use the following code I have found in this forum. Non of the shortcuts starting with <Alt> are recognized.
private void AddinModule_OnKeyDown(object sender, ADXKeyDownEventArgs e)
{
Keys key = (Keys)e.VirtualKey;
System.Diagnostics.Debug.WriteLine("!!! " + TranslateToString(e.Ctrl, e.Shift, false, e.VirtualKey));
}
private string TranslateToString(bool ctrl, bool shift, bool alt, int key)
{
string text = String.Empty;
Keys k = (Keys)key;
if (!ctrl && !shift && alt)
{
text = "Alt+" + TypeDescriptor.GetConverter(typeof(Keys)).ConvertToString(k);
}
else
{
if (ctrl)
text += "Ctrl+";
if (shift)
text += "Shift+";
if (alt)
text += "Alt+";
text += TypeDescriptor.GetConverter(typeof(Keys)).ConvertToString(k);
}
return text;
}
Please can you help me? |
|
Andrei Smolin
Add-in Express team
Posts: 19138
Joined: 2006-05-11
|
Hello Michael,
The keyboard shortcut component with the settings below works for me in Word 2016. Please let me know if it works for you in Word 2003.
Andrei Smolin
Add-in Express Team Leader
#region Component Designer generated code
/// <summary>
/// Required by designer support - do not modify
/// the following method
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.adxKeyboardShortcut1 = new AddinExpress.MSO.ADXKeyboardShortcut(this.components);
//
// adxKeyboardShortcut1
//
this.adxKeyboardShortcut1.ShortcutText = "Alt+T";
this.adxKeyboardShortcut1.Action += new AddinExpress.MSO.ADXAction_EventHandler(this.adxKeyboardShortcut1_Action);
//
// AddinModule
//
this.AddinName = "MyAddin196";
this.HandleShortcuts = true;
this.SupportedApps = AddinExpress.MSO.ADXOfficeHostApp.ohaWord;
}
#endregion
private AddinExpress.MSO.ADXKeyboardShortcut adxKeyboardShortcut1;
...
private void adxKeyboardShortcut1_Action(object sender)
{
MessageBox.Show("adxKeyboardShortcut1_Action");
}
|
|
Michael M?ller
Guest
|
Hi Andrei,
i tried your code but it doesn't work in Word 2003.
Regards
Michael M?ller |
|
Andrei Smolin
Add-in Express team
Posts: 19138
Joined: 2006-05-11
|
Hello Michael,
Alt+T expands the Tools menu in Word 2003. I've tested Ctrl+Alt+Shift+T and Word 2003 (unlike Word 2016) doesn't let us intercept it.
Summing up, the host application is able to prevent the add-in from getting this or that key (key combination) via a keyboard Windows hook. This is by design and you cannot do anything about it.
Andrei Smolin
Add-in Express Team Leader |
|
Michael M?ller
Guest
|
Hi Andrei,
I think we have a general problem with the alt key. If I debug my project with addinexpress in vs 2013 I can't trigger the "Menu Bar" in word 2003. I have installed no other version of word. If I press Alt+D (Datei = File) the commandbarpopup should be opened but nothing happens even any other commandbarpopup from the "Menu Bar" opens by pressing any alt key combination.
It even not work with the older Version 7.7.4087 Standard.
How can I resolve the problem?
Regards
Michael M?ller |
|
Andrei Smolin
Add-in Express team
Posts: 19138
Joined: 2006-05-11
|
Hello Michael,
I don't believe that the Add-in Express version used can relate to this issue. I assume you don't see any issues with the Alt key if you load a new empty add-in in Word. If so, the behavior that you see is induced by your code handling the OnKeyDown event; consider commenting it out.
Andrei Smolin
Add-in Express Team Leader |
|