Hi,
I’m very new to JUCE so this is bound to be a really dumb question…
I’m trying to get a DrawableButton to work on my interface (its an audio plugin, but I don’t think that’s significant which is why I’m posting in the general forum).
I’ve got it so that the button starts displaying my “off” image, but to get it to change to my “on” image, I have to click it and then move the mouse away from its hit area. Once its showing the “on” image, to get it to go back to the “off” image again, I have to click it and then move my mouse away again.
What I want is for it to change image when I click it, and for me not to need to move my mouse away.
Please, does anyone have any idea what I’m doing wrong here?
Here’s my code (I’m pulling the images for the button out of one image which has the “off” state in the top half, and the “on” state in the bottom half VSTGUI style).
Image imageBtn = ImageFileFormat::loadFrom (BinaryData::analysis_button_png, BinaryData::analysis_button_pngSize);
Rectangle<int> rectBtnOff = imageBtn.getBounds();
rectBtnOff.setHeight( rectBtnOff.getHeight() / 2 );
Rectangle<int> rectBtnOn = rectBtnOff;
rectBtnOn.setPosition( 0, rectBtnOff.getHeight() );
DrawableImage dimageBtnOff, dimageBtnOn;
dimageBtnOff.setImage( imageBtn.getClippedImage( rectBtnOff ) );
dimageBtnOn.setImage( imageBtn.getClippedImage( rectBtnOn ) );
addAndMakeVisible(&m_btnAnalysis);
m_btnAnalysis.setBounds (514, 359, rectBtnOff.getWidth(), rectBtnOff.getHeight() );
m_btnAnalysis.setEdgeIndent(0);
m_btnAnalysis.setClickingTogglesState(true);
m_btnAnalysis.setBackgroundColours( Colours::transparentBlack, Colours::transparentBlack );
m_btnAnalysis.setImages( &dimageBtnOff, 0, 0, 0, &dimageBtnOn, 0, 0, 0 );
Thanks for any help
Paul