Annoying Beep with Alt Key

I mentioned this before and nothing was done.

Jules, please fix this.

Pressing Alt + any key causes a beep. This also occurs in the juce demo.

What’s to fix? Any key that isn’t consumed will cause a beep… You can either have something that uses the keypress, or override LookAndFeel::playAlertSound to ignore it.

Ctrl keys + other ascii keys that are not consumed, do not beep. Only the alt key and there is no way to consume the key stroke and prevent the beep. I am using the alt as a shortcut. Can you please look at this and tell me how to prevent the beep? it is very, very annoying.

Which OS? Is it a plugin or app?

Windows OS and I am sure this is a Windows thing, but other programs have some how disabled it. I am also looking into to it. I would deeply appreciate your help on this.

BTW, I have full printing working in my application and if you remember my app has a ton of printing. When I ship it, I’ll let other know how I did it. I did not go through the LowLevelRendering routines because of text.

I believe there is some lo, low, level place to return true to the operating system that the key has been consumed. The problem Juce must always return false, even if a shortcut has been defined. I could be wrong and I am looking into it.

BTW, this is all over the internet about this and the only solution I have found is for the key handler from the OS, to return true.

The problem is that Windows uses the Alt key to handle its menus and because juce has it’s own menus, windows beeps when the key stroke is not used. So juce needs to disable this if using juce menus. Does this make sense?

BTW

Well… I think it’ll be either the WM_SYSKEYDOWN or WM_APPCOMMAND messages that’ll catch it. But both of those should return 0 correctly if the app consumes the keystroke. I’m too busy right now to launch Windows and debug, but will have a think.

Yes that is where I have been looking, but returning true or false causes the beep. I can’t seem to stop it.

The problem is in

KeyPressMappingSet::keyPressed .... if (originatingComponent != nullptr && commandWasDisabled) originatingComponent->getLookAndFeel().playAlertSound();

I’ll have this solved soon, I hope.
And I use the Alt Keys as shortcuts. And because I have used these shortcuts for in my app for a long time, I don’t want to change them because of this.

Thanks.

I was wrong. Even if I disable this, the OS still beeps. I’ll keep looking.

I have found a fix:

Juce needs to process the WM_MENUCHAR message and return something in the high byte to tell windows the message has been handled.

case WM_MENUCHAR:
    return MNC_CLOSE << 16;
    break;

WOW that was a lot of work for a simple problem.

Wow, never heard of that event before! Thanks, I’ll make sure it handles that!