[RESOLVED - my mistake] ImageButton not showing


#1

I have an ImageButton that I added to a view component, but it never show up! It uses an up image and a down image, which are in the project and appear correct in Projucer. And the button shows up in another project that uses the exact same images. But when that view component shows, it does not ever show the button! The tooltip shows when I hover over where it should be, and if I click the button, it behaves correctly, but not graphics ever show for it in this project. Any idea what could be wrong? Here is the code that gets inserted for the button:

    myButton.reset (new ImageButton ("myButton"));
addAndMakeVisible (myButton.reset());
myButton.reset->setTooltip (TRANS("Click here"));
myButton.reset->setButtonText (String());
myButton.reset->addListener (this);

myButton.reset->setImages (false, true, true,
                               ImageCache::getFromMemory (BinaryData::myButton_png, BinaryData::myButton_pngSize), 1.000f, Colour (0x00000000),
                               Image(), 1.000f, Colour (0x00000000),
                               ImageCache::getFromMemory (BinaryData::myButtonPressed_png, BinaryData::myButtonPressed_pngSize), 1.000f, Colour (0x00000000));
myButton->setBounds (16, 192, 327, 31);

#2

Hi, not sure it can help, I use this with success… Have you try without the setButtonText ?

imgVCA = ImageFileFormat::loadFrom(BinaryData::VCA_png,(size_t) BinaryData::VCA_pngSize);
   btVCA.setImages (false, true, true,
                  imgVCA, 0.7f, Colours::transparentBlack,
                  imgVCA, 1.0f, Colours::transparentBlack,
                  imgVCA, 0.6f, Colours::transparentBlack,
                  0.0f);

#3

Never mind! I forgot about the custom Look&Feel code we had, which in this project hadn’t been updated properly to draw our image buttons. D’oh! :slight_smile: