Buttons getting re-enabled

Hi,

I created a "TransportBar" class that inherits the Component class to hold some TextButtons. I then gave it a function to disable all the buttons. 

In MainComponent I created a TransportBar object and at the end of the constructor for MainComponent, I run the function to disable the buttons. Some quick test code shows me that at this point, the buttons are indeed disabled so everything works so far. 

By the time the program gets around to calling paint() on my MainComponent though, the buttons have been enabled somehow. 

So when the application opens, the buttons are enabled instead of being disabled. 

What could possibly be enabling the buttons in my TransportBar object?

 

Thanks in advance

Put a breakpoint in your MainComponent where it calls the disable function, after executing that function, put a breakpoint on the button enable function, continue execution, and the cuplrit will reveal itself.

Did the trick! Thanks. 

For curious ones: seems buttons will enable themselves if you setCommandToTrigger and give it a valid command to trigger. My solution is to call setCommandToTrigger and use nullptr as the Command Manager to essentially remove the command. Then I can disable the button happily.