Updating an ApplicationCommandInfo


#1

What's the best approach for updating a registered command's "ticked" flag (or set of flags, for that matter)?

As it is, the only methods for getting a command by an ID through the ApplicationCommandManager is by calling getCommandForID() or getCommandForIndex(), which returns a const ApplicationCommandInfo...

And of course, ApplicationCommandManager::registerCommand() has a nice big assertion in there to promptly make you think if you're doing the right thing or not. But honestly, re-registering a command to update it sounds like the wrong way to go about doing so.

Why not have something like:

ApplicationCommandManager::updateCommand(ApplicationCommandInfo& newInfo)
{
//Find the command, if it exists
//Replace its contents, if a command has been registered with this id
//Update listeners (commandStatusChanged() ?)
}

#2

Nada on this one, Jules?


#3

If I understand the question correctly, can't you just call commandStatusChanged() and then rely on your command to return a different value for its 'ticked' status?


#4

I've run into this same issue in a different application, so am revisiting the post.

 then rely on your command to return a different value for its 'ticked' status?

This is honestly the part that I'm murky on: doing that is not obvious.


#5

Ah, I see: my problem lies in the fact that I'm always registering all my targets' commands, so now I have to manually register the stateless commands if need be, and let the system automagically do the rest for stateful ones.

I guess I've more to dig into...