<Alt> shortcuts don't work

Add-in Express™ Support Service
That's what is more important than anything else

<Alt> shortcuts don't work
 
Michael Müller




Posts: 46
Joined: 2014-07-17
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?
Posted 23 Nov, 2018 09:39:22 Top
Andrei Smolin


Add-in Express team


Posts: 16662
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.

Regards from Belarus (GMT+3),

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");
        }
Posted 27 Nov, 2018 07:26:28 Top
Michael Müller




Posts: 46
Joined: 2014-07-17
Hi Andrei,

i tried your code but it doesn't work in Word 2003.

Regards

Michael Müller
Posted 27 Nov, 2018 09:37:42 Top
Andrei Smolin


Add-in Express team


Posts: 16662
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.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 28 Nov, 2018 05:20:01 Top
Michael Müller




Posts: 46
Joined: 2014-07-17
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
Posted 29 Nov, 2018 03:56:05 Top
Andrei Smolin


Add-in Express team


Posts: 16662
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.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 29 Nov, 2018 06:30:46 Top