When is ApplicationCommandTarget::getCommandInfo() called?


#1

I have a button that I only want to be clickable when certain parameters are met. The button triggers the following command:

void getCommandInfo(const CommandID commandID, ApplicationCommandInfo& result){
	.
	.
	switch(commandID){
		.
		.
		case gameAction_play: 
			result.setInfo(T("Play"), T(""), gameActionCategory, 0);
			result.setActive(gameThread->isThreadRunning() && boardComponent->isMoveValid());
			break;
	.
	.
	}
}

setActive(…) should enable/disable the button, and does sometimes, but I can’t figure out what the child components need to do to get the button to refresh itself every time the parameters change.


#2

getCommandInfo can’t be called continuously, so if you’re changing something that might affect it, call ApplicationCommandManager::commandStatusChanged to make it refresh.

(I should add a comment about this to the getCommandInfo help)


#3