Cmd + 0 shortcut?

Is there an easy way to get a “Cmd + 0” shortcut?

addDefaultKeypress ('0', ModifierKeys::commandModifier);

The code above doesn’t work (on my laptop). I guess i need to add shift.

... ('0', ModifierKeys::shiftModifier | ModifierKeys::commandModifier);

It works, but it is no more the same shortcut. :woozy_face:

Is this possible without the shift key (in a portable way)?

Are you talking about Mac? Cmd + 0 works for me as a key shortcut. And that’s exactly how I assign it in getCommandInfo(). Is it possible your system is interfering?

Assuming you’re using a French layout, try to use the base symbol from the key:

addDefaultKeypress ('à', ModifierKeys::commandModifier);

Yes it is a french layout: < AZERTY - Wikipedia >.
I should have tell it first.
I already struggled a lot with PureData and Tcl/Tk to bind those keys on various layouts.
And it seems that JUCE will not magically resolve this for me.
I mean an easy and portable way.

I’m somewhat surprised that FR doesn’t have more votes. It got mine, and it’s absolutely needed for stuff like a virtual MIDI keyboard if for instance on a standard QWERTY you used the home row A to be the C note, suddenly it’s complètement cassé for French users with AZERTY keyboards. :person_shrugging:

edit: also komplett kaputt for Germans with QWERTZ keyboards. It’s utterly frustrating that i18n is more or less ignored in so many cases. :frowning:


I have just noticed that i can call addDefaultKeypress twice (at least). Used it as a workaround to enable the +/= key on my AZERTY thinkpad. Sadly the menu shows both keys.

With JUCE only the 26 globish letters can be used easily. For a complex application, much more keys are required. I can NOT even use usual + / - / 0 keys for zoom management. That’s a serious limitation.

Oh yeah the default drawing code for the shortcuts is something… and to make it even worse (just as the drop shadow with sliders bubble popup components) it is a forced hard-coded design decision which cannot be overridden by the standard look and feel method and which I really don’t understand. When re-designing my own menus, I needed so much code to undo what the JUCE code does with the shortcuts displaying, I went nuts. My apologies for it being a little off topic but still somewhat related to shortcut and menus.

1 Like

Thanks a lot for your reply!
TBH i didn’t remember that i also made my own menus on Linux! :sweat_smile:
And such i can parse the shortcut string before rendering.

1 Like