Bug: can't add the same graphic multiple times

I ran across a bug in the Introjucer. (Or I did something wrong - I'm new to JUCE.) In the GUI editor, in the Graphics tab, you can add images to the background of your custom component.

So what I did was add a PNG file to the component as a resource, and then I added an image to the component's background in the Graphics tab. For the image source, I chose the PNG resource I had added.

So far, so good. It builds and runs. Now I add a second image to the background, and I set the image source to be the same PNG resource. Now it no longer builds. Introjucer adds the following line twice to the header file:

 

    Image cachedImage_bigonion_png;

    Image cachedImage_bigonion_png;

(My PNG resource was called bigonion.png.)

So unless I'm doing something wrong, it seems that Introjucer is using the image's name as a basis for the variable name, and there doesn't seem to be a way to override the variable name for background images.

Is this a bug, or did I do something wrong?

Hi there,

thanks for bringing this up! Yes, it is a bug in Introjucer.

There is a mechanism in Introjucer which adds unique suffixes (_1, _2, ...) to the auto-generated variable names, to prevent this. But unfortunately these suffixes were not used for the variable names of Image objects, causing the problem.

It should be fixed now. Please update to the newest tip, re-build Introjucer, and re-save your project.

Yep, that did the trick - thanks for the quick turnaround!