Sending metadata with commands

Hi there,

I’m a new Juce developer, and when using Juce’s command system I ran into an issue I’m sure other people out there have dealt with, however couldn’t found any information on how to solve this. Most of the commands my application uses apply on target components or data, IE. my moveTab command which move a tab from one panel to another.

Because commands are just ints, not some struct/ class I can inherit from, I don’t know how to couple data to my commands.

The only solution I could come up with is maintain some global queue in my code which can be written to when creating the command, and can be read from when performing it, however this doesn’t seem a very elegant solution to me.

Anyone has ideas on this?

I’m not sure what you mean by ‘commands’, but you could use MessageManager::callAsync with a lambda to do what ever you want on the message thread.
MessageManager::callAsync ([]() { // do your thing here });