How do I change the colour of the toggle button


#1

Is there a method or colourid for changing the colour of the button in a toggle button?


#2

I have another question about the toggle button. Does it not have a listener callback method?


#3

It’s a button - it inherits all the button callbacks. I think you can change its colour by changing the TextButton::buttonColourId colour.


#4

Yes that works. I tried doing ToggleButton::buttonColourId and that didn’t work.

It is not clear to me why this works though. ToggleButton inherits the Button class members but why does it also inherit the TextButton members.

ToggleButton and TextButton both inherit the Button class according to the documentation but not each other’s class. Shouldn’t the reference be Button:buttonColourId?


#5

It just works because the LookAndFeel happens to use that the same utility method to draw the text button and the background of the toggle button.