can we get the documentation updated for paintButton()
's 3rd parameter to reflect the actual purpose? I just burned a couple hours trying to figure out why my button wasn’t painting correctly because of my misunderstanding of the function of that 3rd parameter.
suggested:
isButtonDown: true if the button should be drawn in the 'down' position.
This parameter does not reflect the actual state of the button, just whether or not
the button is currently being "pressed down" by the mouse cursor.
use getToggleState() to get the state of the button
I’m sure there are a bunch of users over the years who naively wrote something like this:
void MyButton::paintButton(Graphics& g, bool isMouseOverButton, bool isButtonDown)
{
if( isButtonDown )
{
//draw button in ON state
}
else
{
//draw button in OFF state
}
}
when what they really want is:
void MyButton::paintButton(Graphics& g, bool isMouseOverButton, bool isButtonDown)
{
if( getToggleState() )
{
//draw button in ON state
}
else
{
//draw button in OFF state
}
}