Hi All,
I have added code to juce demo to display about and preferences menu items in the apple menu. It shows up and I am able to handle mouse clicks, but I couldn’t display short cut keys
Hi Jules,
I had a question, where does juce menu pick up “Hide application_name” and “Quit application_name” menu items of application name menu. Is there any way to change the names of these two menu items?
Thanks Jules. I will give it a try. The reason I asked for this was because we have release every other month and we change our application version, but the menu item had the older version name. So I need to get into native code to change the code to show my application name without version.
void getCommandInfo (const CommandID commandID, ApplicationCommandInfo& result)
{
...
case showFontsAndText:
result.setInfo (T("Fonts and Text"), T("Shows the fonts & text demo"), demosCategory, 0);
result.setTicked (currentDemoId == showFontsAndText);
result.addDefaultKeypress (T('G'), ModifierKeys::commandModifier); // used G instead of g
break;
}
This was the result.
If I replace lower case letters with upper case letter the menu add shift key to the short cut key. Should it be working like this?
You really shouldn’t use upper case in defining a keypress - if the keypress had no shift modifier, but had an upper case letter, that’s self-contradictory. Stick to lower-case for keypresses, to avoid any confusion.
I was pretty dumb there and you have got a valid point there. It’s just that the guys before me had used upper case letters for shortcut keys and it all worked fine till we moved to juce 1.50. Anyway got the issues resolved. Pleased to inform you finally for first time we are not using main.nib file for the menu.
I have another question, is there anyway to hide a menu item in menu bar.
[quote=“jules”]I’ve actually put an assertion in the KeyPress class now to catch anyone doing the same thing.
not sure I understand… To hide it, you just don’t add it to the menu, right?[/quote]
Am responsible for a assertion now. That makes me really proud :oops: . I should have put the query more clearly. Well I got it to work.
Just to explain what I meant , Suppose I have a menu item called plugins which shows up only if plugins are installed and is hidden when all the plugins are uninstalled. I wanted to know how to handle that(hiding and unhiding the menu item).
Well, somewhere in your code, you’re calling menu.addItem(“plugins”)… so if you don’t have any plugins, don’t do that… ?? Or maybe I’m still missing the point!
I realized, every time my application gains focus this method is called “const StringArray getMenuBarNames ()”. I used it to code for the feature. Thanks for all the help.
I disagree with this and so does Microsoft and Apple. Microsoft and Apple both user uppercase. Juce applications may actually confuse users because they are use to seeing uppercase. You see the short cuts are displaying the characters on the computer keyboard, which are upper case and the user doesn’t have to think about upper/lower case except in special exceptions. More importantly the keypress character should be [color=#FF0000]what ever the developer wants it to be[/color]. PLEASE don’t make assumptions that restrict everybody. Juce is a [color=#FF0000]beautiful [/color] environment, except for these decisions that make it very difficult to get what you want. I found this old post because I want upper case for the short cuts. How can I do this? The Look and Feel doesn’t allow this. Also can we make the letters normal size, instead of the very small letters. Mnay of my users are over the age of 50 and don’t have perfect vision.
I was talking about the char code that you pass to in the KeyPress constructor, not the way the letter that gets displayed on the screen. The code that prints a shortcut can do whatever it wants, that’s a different thing altogether.