So, I often find myself in the given scenario:
- I have a
juce::Buttonthat I want to programmatically change its state
- This change in state must update the UI and listeners, therefore I’m obligated to send notifications, by calling
- On the other hand, this button has a
onClickmethod that I do not want to be called, because it should be called only when, well, the user clicks the button. But when sending notifications, the
onClickand all click notifications/methods gets called anyway. That’s because the
setToggleState()is for both the click and the state notifications.
It seems that Button already has a method that separates those 2 notifications:
setToggleState(bool, clickNotification, stateNotification), and that’s exactly what I’m looking for, but it is private.
Are there any reasons this method is private and we should avoid using it on the scenario above? If not, I’d suggest to make it public because right now I have to do some fancy workaround to avoid the clicks being called.