Freaky Button Name Bug


#1

I’m been making some buttons in Jucer and running into the weirdest bug. If the button’s member name and text are the same, Jucer doesn’t create a set button name method. Later, when my custom button sub-class calls the LookAndFeel get button text function to draw the text, it comes up blank.

Amazed this hasn’t come up before - it must be just this set of circumstances.

Bruce


#2

But if the names are the same, it doesn’t need to call setButtonText - the text is set by the constructor (?) Are you overriding setButtonText or something?


#3

Nope. I added a setColorAndIcon method and left the rest:

[code]class MeshPanelButton : public TextButton
{
public:
//==============================================================================
MeshPanelButton (const String& buttonName);
~MeshPanelButton();

//==============================================================================
//[UserMethods]     -- You can add your own custom methods in this section.
void reallyPaintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown);

void setColorAndIcon (juce::Drawable* newIcon, const Colour& newColor, const Colour& offColor = Colour (0xe0333333));
//[/UserMethods]

void resized();
void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown);

//==============================================================================
juce_UseDebuggingNewOperator

private:
//[UserVariables] – You can add your own custom variables in this section.
Colour buttonColor;
Colour offColor;
juce::Drawable* buttonIcon;
//[/UserVariables]

//==============================================================================


//==============================================================================
// (prevent copy constructor and operator= being generated..)
MeshPanelButton (const MeshPanelButton&);
const MeshPanelButton& operator= (const MeshPanelButton&);

};

[/code]

And then. D’oh. Sorry: MeshPanelButton::MeshPanelButton (const String& buttonName)
: TextButton (String::empty)

Disregard. I owe you 20kb.

Bruce