Question about addDefaultKeyPress()


#1

I’m using the following method to attach key presses to commands. They all work except for the case of ‘save as’ which uses command and shift modifiers. Am I going about specifying ctrl+shit in the right fashion? ? I tried searching the forum for adddefaultkeypress but I was told that my search contained too many common words or something along those lines so I couldn’t actually search the forum for this. Apologies in advance if it’s been covered before.

void myEditor::getCommandInfo (const CommandID commandID, ApplicationCommandInfo& result)
{
switch (commandID)
{
case CommandIDs::fileNew:
result.setInfo (T(“New”), T(“Create a new file”), CommandCategories::file, 0);
result.addDefaultKeypress (T(‘n’), ModifierKeys::commandModifier);
break;
case CommandIDs::fileOpen:
result.setInfo (T(“Open”), T(“Open a file”), CommandCategories::file, 0);
result.addDefaultKeypress (T(‘o’), ModifierKeys::commandModifier);
break;
case CommandIDs::fileSave:
result.setInfo (T(“Save”), T(“Save a file”), CommandCategories::file, 0);
result.addDefaultKeypress (T(‘s’), ModifierKeys::commandModifier);
break;
case CommandIDs::fileSaveAs:
result.setInfo (T(“Save as”), T(“Save file as…”), CommandCategories::file, 0);
result.addDefaultKeypress (T(‘s’), ModifierKeys::shiftModifier | ModifierKeys::commandModifier);
break;
}
}


#2

Yeah, that should work as long as you’ve used a lower-case ‘s’… Which platform is it failing on?


#3

Sorted, it was because I wasn’t returning all my commands in my getAllCommands() method. Sorry for the noise.