ApplicationCommandTarget , using same key to do different things depending on current focus (ctrl-x, for example)

I’m sure I’m missing something simple, but I don’t see how to leverage the ApplicationCommandManager/Target classes to have different behavior for a command depending on context. ie. I want StandardApplicationCommandIDs::del to do different things depending on which window is in focus (as well as be enabled/disabled based on different criteria). My first thought was that I register two ApplicationCommandTargets, which register the same commands/keys, and do the right thing in the perform() function. But that doesn’t seem to work. Am I missing something? The other way I can see to implement it is to have one ACT that handles the command, and somehow manages to know what the current context is, and then chooses to do the correct thing based on that. Any help would be appreciated.

1 Like