drawImage and buttonlistener


#1

I’m trying to display 2 Images . When a Togglebutton is checked it should display the first image , unchecked the second image .

I’m using the jucer to load the images .
But the togglebutton seems to return "false " always ?
The code is inside the paint (graphics& g) : is this the way to do this?

[quote]if(toggleButton->getToggleState())
{
g.setColour (Colours::black);
g.drawImageWithin (cachedImage_knop1_jpg,
19, 163, 200, 55,
RectanglePlacement::centred,
false);
}
else
{

g.setColour (Colours::black);
g.drawImage (cachedImage_knop2_jpg,
             243, 163, 100, 60,
             0, 0, cachedImage_knop2_jpg.getWidth(), cachedImage_knop2_jpg.getHeight());
}[/quote]

#2

got it :roll:

http://www.rawmaterialsoftware.com/viewtopic.php?f=2&t=5087&hilit=buttonlistener