# ApplicationCommandManager question

**URL:** <https://forum.juce.com/t/applicationcommandmanager-question/1521>\
**Category:** General JUCE discussion\
**Created:** [March 7, 2007, 1:37pm UTC](https://forum.juce.com/t/applicationcommandmanager-question/1521 "2007-03-07T13:37:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![yanco](https://avatars.discourse-cdn.com/v4/letter/y/cab0a1/32.png) [@yanco](https://forum.juce.com/u/yanco)\
**Post date:** [March 7, 2007, 1:37pm UTC](https://forum.juce.com/t/applicationcommandmanager-question/1521/1 "2007-03-07T13:37:05Z")

</div>

Hi all,  
I read something in the documentation but am not quite sure I understand it correctly. Could someone please show me on an example when is the ApplicationCommandManager useful? I can use Listeners for the same thing, can’t I?

(sorry if this is a really dumb question…)

Thanks in advance.  
Y.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [March 7, 2007, 1:45pm UTC](https://forum.juce.com/t/applicationcommandmanager-question/1521/2 "2007-03-07T13:45:39Z")

</div>

It’s useful, honestly. Otherwise I wouldn’t have wasted so much time writing it!

It makes it easy to route commands to the appropriate targets, e.g. a “copy” command might be mapped to one key-press, but would go to different targets depending on which UI component is focused. It also means you can use the same mechanism to trigger commands by key-presses, buttons, menus, or other things.

Sure you could do everything with low-level listeners, but in a medium-sized app you’ll find that quickly becomes very messy.

---

<div class="post-metadata">

**Author:** ![yanco](https://avatars.discourse-cdn.com/v4/letter/y/cab0a1/32.png) [@yanco](https://forum.juce.com/u/yanco)\
**Post date:** [March 7, 2007, 3:40pm UTC](https://forum.juce.com/t/applicationcommandmanager-question/1521/3 "2007-03-07T15:40:49Z")

</div>

[quote=“jules”]It’s useful, honestly. Otherwise I wouldn’t have wasted so much time writing it!  
[/quote]  
:lol: Yeah exactly, I saw it was pretty complicated and I somehow “knew” it must be useful although I couldn’t quite grasp how…

So it works that the ACM sends message to the first ApplicationCommandTarget which then issues commands through its perform() method. If it can’t handle it it, the getNextCommandTarget() determines who is the next to try it.

Do I get this right? Or am I still missing something?  
Thanks.  
Y.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [March 7, 2007, 4:11pm UTC](https://forum.juce.com/t/applicationcommandmanager-question/1521/4 "2007-03-07T16:11:37Z")

</div>

Yeah, that’s pretty much how it works. It’s hard to explain, but makes sense when you use it.

---

<div class="post-metadata">

**Author:** ![yanco](https://avatars.discourse-cdn.com/v4/letter/y/cab0a1/32.png) [@yanco](https://forum.juce.com/u/yanco)\
**Post date:** [March 7, 2007, 5:15pm UTC](https://forum.juce.com/t/applicationcommandmanager-question/1521/5 "2007-03-07T17:15:29Z")

</div>

> [@jules](#):
>
> Yeah, that’s pretty much how it works. It’s hard to explain, but makes sense when you use it.

Thanks, I will try to get more into it in practical application 🙂  
Y.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [May 12, 2017, 8:57pm UTC](https://forum.juce.com/t/applicationcommandmanager-question/1521/6 "2017-05-12T20:57:40Z")

</div>

Closed on May 12, 2017, 8:57pm UTC


