I have made a class to create my own style of buttons, this class inherits from the component class and makes use of the mouse event methods (MouseEntered MouseDown ect…) to change the buttons graphics when a button is interacted with.
Ive included my custom button class in another component class to create a panel, this panel is made up of instances of my custom button and sliders, an instance of the panel class is then created in pluginEditor.h
Is there a method I can add to the pluginEditor to listen out for mouse events of my custom button class? I know buttons, sliders and comboboxes have this functionality by adding a listener to them and overriding the value changed methods, I’m just not aware of what the best option would be in this situation and I’m after some advice.
Thanks in advance
Hi. The usual way to handle this situation would be to change the LookAndFeel methods for rendering the buttons and continue to juce a Button class to handle the button activity.
Hey @leehu I had a go at this approach but I ended up getting bogged down with the lookAndFeel part of it.
My buttons behave the way I want for the most part, Im just after a way to within the pluginEditor get component clicked mouse events when a particular instance of my button class is clicked.
Would addMouseListener be what Im after?
yes, that should work if you want to monitor clicks etc. rather than listening to mouse clicks on buttons in the editor though, you’d be better off following the method employed in a button whereby the you have a Listener class which is what the editor registers.
I would recommend you persevere with the LAF approach - it underpins so much in JUCE for rendering so it’s worth understanding it - it’s really not that complex.
Thanks for the advice @leehu, this was the push I needed to begin getting my head around the LAF class. My code now has the desired functionality and is much more succinct.
P.S. love the techno!