Toolbars... actually using them?

I’m quite the poster lately, no?

So, how are you actually supposed to use the Toolbar? I.e. actually respond to items being clicked on it? Do you register the item with a ButtonListener when you create it in the createItem function within the factory and respond by ID?

I get the feeling a ‘ToolbarItemListener’ class will be beneficial - with a simple ‘toolbarItemClicked (int itemId)’ function… at the moment, reading the docs, there is literally not a single piece of information there explaining how to respond to these toolbar buttons!

please tell me i’m missing something! :slight_smile:

actually Toolbar use is quite straightforward. if you switched to use ApplicationCommandManager/Targets, is easy to built your buttons based on generic defined to the application CommandIDs (the same that u use for building menus): Buttons have all the setCommandTarget or whatever that let you select which globally defined Command they should trigger. In the same way, you make your toolbar a ApplicationCommandTarget, that responds to some actions, or forward some actions’ behaviour to the main application. in this way you can handle your buttons trigger inside the Toolbar, or leave the button trigger a global defined Command. Also, there is no need to have “buttons_ids” in the Toolbar to define the identifier for the buttons, since you can normally use your global command ids for identify them. i’ve built an application that responds to Commands, then if i trigger them from menus or buttons (also in a toolbar) or whatever else (using invoke) there is no difference at all. hope it will be useful idea…

I can’t figure it out either. I have absolutely no idea what the ApplicationCommandManager stuff is about in the previous response. Can anyone please help me figure out any way to find out when a toolbar button is clicked? If anyone has an example, that would be great! Thanks in advance.

P.S. I finally got through doing some of the ApplicationCommandManager stuff and I have to say that it still doesn’t work properly and this is completely unnecessary effort. Examples of stuff not working properly include toolbars randomly having or not having color, menu items randomly working or not working, etc… Why is the rest of JUCE so cool and this toolbar listener completely neglected?