nicolas
#1
Hi,
I found an issue in ImageButton which is quite easy to fix :
- In the function getCurrentImage(), you are returning downImage when button is down or toggled
- In the function paintButton(), you are sending down opacity only if button is down
Could you send down opacity when button is toggled ? As you do in getCurrentImage() for image to use ?
Thanks 
Best regards
jules
#3
Sorry, don’t quite understand…?
nicolas
#4
First, there is the ::getCurrentImage() which takes into account the down AND toggle states to return the down image.
Image ImageButton::getCurrentImage() const
{
if (isDown() || getToggleState())
return getDownImage();
if (isOver())
return getOverImage();
return getNormalImage();
}
Second, there is the code at the end of the ::paintButton() function. You do not take into account the toggle state to return the overlay.
getLookAndFeel().drawImageButton (g, &im, imageX, imageY, imageW, imageH,
isButtonDown ? downOverlay
: (isMouseOverButton ? overOverlay
: normalOverlay),
isButtonDown ? downOpacity
: (isMouseOverButton ? overOpacity
: normalOpacity),
*this);
This could be the following code, in order to return down overlay if button is toggled, as it is done in getCurrentImage() function.
getLookAndFeel().drawImageButton (g, &im, imageX, imageY, imageW, imageH,
(isButtonDown || getToggleState()) ? downOverlay
: (isMouseOverButton ? overOverlay
: normalOverlay),
(isButtonDown || getToggleState()) ? downOpacity
: (isMouseOverButton ? overOpacity
: normalOpacity),
*this);
jules
#5
Ah! I see what you mean - thanks, that does seem like a good idea!
nicolas
#6
Yes I have done it internally to view what it will do in live, and it is really better 
Thank you for this modification.
You do a great job !