DrawableButtons - how to force a call to buttonStateChanged?


#1

Hello, and Happy New Year!

I have a lot of drawable buttons. Unfortunately, they weren’t displaying in their disabled state, no matter what I did.

Other Juce components disable very well. You can disable them, or you can disable any parent, and they redisplay fine.

When I dug down into it, I discovered that buttonStateChanged would need to be called for the image to change - but that setEnabled, either on the button’s parent components or on the button itself, does not trigger buttonStateChanged.

And unfortunately buttonStateChanged is protected.

So I ended up having to derive my own DrawableButton class to expose buttonStateChanged, then when I enable or disable, I walk the tree of components to find these buttons, and also call buttonStateChanged.

Is there a better way to do this?


#2

Thanks - in fact, I think I just need to add an enablementChanged() callback to DrawableButton, and use that to force it to update… That’s easy, will do it today!


#3

Oops, forgot to say thanks! So… thanks!


#4

Just doin’ my job…