ImageButton problem


#1

Hi all,

I'm trying to display an ImageButton, loading the three images from file.


Image normal = ImageFileFormat::loadFrom(juce::File("Normal.png"));
Image over = ImageFileFormat::loadFrom(juce::File("Over.png"));
Image down = ImageFileFormat::loadFrom(juce::File("Down.png"));

ImageButton* btnImg;
btnImg = addToList(new ImageButton("Test"));
btnImg->setBounds(150, 310, 1, 1);
btnImg->setImages(true, false, true, normal, 1.0f, Colours::black, over, 1.0f, Colours::white, down, 1.0f, Colours::yellow);

The images seem to be loaded correctly, but I do not see them, instead I see a black square of the size of the image (and white if over, yellow if button down). Also, if I put a listener, it response correctly to the click...

Where am I wrong? If I create a TextButton instead, everything works fine.

Thanks


#2

hi.

i think it's because your colours are opaque! try adding some transparency to it :

Colours::black.withAlpha (0.2f)


#3

Many thanks