I use setMacMainMenu to add menu items to the application menu, some items have shortcuts.
Sometimes when i select an item in the menu or use the shortcut OSX gives me a beep, it’s a standard beep that is used all over the system if an action that is taken can’t be executed.
When using the rest of the menu i never get beeps when actions can’t be executed.
As we are making Audio software i don’t want this beep to be audible, does anyone have a clue to disable this. It this something you could disable on application level?
I found this, it probably removes some beeps from my application but does not prevent my menu generating them.
void MyLookAndFeel::playAlertSound()
{
return; // instead of PlatformUtilities::beep();
}
It only beeps when your menu sends a command that isn’t accepted by any command target. If your commands and targets are set up correctly, it shouldn’t need to beep!
Well, before i moved the items to the macMainMenu they never beeped, and they never needed to either (because i do think i have setup things correctly). I will try to see if i can reproduce the beeps in the Juce Demo with the latest GIT version.
And if i’m doing things wrong or when a no target is found for a command, how to prevent it from beeping. I would like to never have beeps if possible.
Well, I use mac main menus without beeping problems, but if you can create some demo code that shows the problem, I’ll take a look…
I’m not quite up to date with the tip(about 8 days behind), but I just noticed my key mappings stopped working… The command manager is still called when I go to the menu manually(not using native toolbar), but just beep when I hit the key commands…
Just thought i’d mention it, i’ll update to git and try to track it down
[EDIT] - JUCE demo is working fine…so it must be me…
I’m building against 10.4u SDK and had to add this to my CFLAGS…
-DMACOS_10_4_OR_EARLIER=1
so that the mac peer would implement performKeyEquivalent. Otherwise it’s not getting compiled…
In my project I have deployment target as 10.4… I’m not sure where if anywhere JUCE defines MACOS_10_4_OR_EARLIER, or if we’re responsible for it, but it fixed me… (until my next GIT update anyways!)
Oh, looks like I missed a couple of the old OSX macros when I updated them. Instead of MACOS_10_4_OR_EARLIER, it should read:
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
Thanks, I’ll tidy that up.
[quote=“gekkie100”]I use setMacMainMenu to add menu items to the application menu, some items have shortcuts.
Sometimes when i select an item in the menu or use the shortcut OSX gives me a beep, it’s a standard beep that is used all over the system if an action that is taken can’t be executed.
When using the rest of the menu i never get beeps when actions can’t be executed.
As we are making Audio software i don’t want this beep to be audible, does anyone have a clue to disable this. It this something you could disable on application level?[/quote]
I also have this problem sometimes on toolbar item which is registered as a command. After I click on a toolbar item (such as open), it beeps. But the command get executed. It’s not 100% reproducible.
I’m not able yet to reproduce the problem in the Juce demo. Like with cxhawk my commands do get executed but give a beep. Only beeps though when the command has a shortcut attached. I will investigate further.
The jucer uses shortcut keys - maybe try to reproduce it in there?
After fixing some more important bugz in our software in the mean time, i return back to the beep issue.
Luckily i found a way to reproduce it, so Jules maybe you can help me out here.
When you click (or use a shortcut) on items that are added to the Apple menu using the extraAppleMenuItems parameter in MenuBarModel::setMacMainMenu(), they beep.
I modified the code in the Demo project to reproduce the problem.
const PopupMenu getMenuForIndex (int menuIndex,
const String& menuName)
{
ApplicationCommandManager* const commandManager = mainWindow->commandManager;
PopupMenu menu;
if (menuIndex == 0)
{
menu.addCommandItem (commandManager, showRendering);
menu.addCommandItem (commandManager, showFontsAndText);
menu.addCommandItem (commandManager, showWidgets);
menu.addCommandItem (commandManager, showThreading);
//menu.addCommandItem (commandManager, showTreeView);
menu.addCommandItem (commandManager, showTable);
menu.addCommandItem (commandManager, showAudio);
menu.addCommandItem (commandManager, showDragAndDrop);
menu.addCommandItem (commandManager, showOpenGL);
menu.addCommandItem (commandManager, showQuicktime);
.......
case useNativeMenus:
if (MenuBarModel::getMacMainMenu() != 0)
{
MenuBarModel::setMacMainMenu (0);
mainWindow->setMenuBar ((ContentComp*) mainWindow->getContentComponent());
}
else
{
PopupMenu* extraItems = new PopupMenu();
extraItems->addCommandItem(mainWindow->commandManager, showTreeView, T("extra show treeview"));
MenuBarModel::setMacMainMenu ((ContentComp*) mainWindow->getContentComponent(), extraItems);
mainWindow->setMenuBar (0);
}
break;
I tracked the beep down and it seems that flashMenuBar is the one that’s causing the beep.
It beeps when calling performKeyEquivalent.
[menu performKeyEquivalent: f35Event];
Thanks, I’ll get that sorted out…
Did you had time to look at this already?
¥eah, that’s fixed.
Thanx Jules, i found the fix and it works!