Skip to main content
Known Participant
October 10, 2014
Question

SetItemCmd not working as expected...?

  • October 10, 2014
  • 0 replies
  • 364 views

Hello everybody,

I'm having trouble calling SetItemCmd in response to some user events.

The related menu item is created in StartupPlugin thusly (error checking skipped):

  error = sAIMenu->AddMenuItemZString(fPluginRef, cmdName, groupName, ZREF("Item Text"),

                                      kMenuItemWantsUpdateOption, &itemHandle);

  error = sAIMenu->SetItemCmd(itemHandle,key,kMenuItemCmdControlModifier | kMenuItemCmdOptionModifier));

At a later moment, in response to a user event, I'm trying to change the command-key thusly:

  error = sAIMenu->SetItemCmd(itemHandle,newKey,kMenuItemCmdControlModifier | kMenuItemCmdOptionModifier));


The first time I invoke this with a valid, free command-key, it works as expected.  The second time I invoke it in response to the same user event, using another valid, free command-key, it still returns no error, but the new command-key is not assigned properly.  That is, the menu item still displays and responds to the previous command-key.

Any idea why the second new command-key assignment might be failing...?

This is on OS X 10.8.x with the CC SDK, targeting both CC and CC 2014.

Thanks,

Dario

This topic has been closed for replies.