drawButtonBackground


#1

Hi all,
I’m having trouble with the above LookAndFeel method for changing the background of my buttons. Basically it has no effect, no matter what I do inside the function! All of my other LookAndFeel methods work fine.
I have my buttons declared as TextButtons, so I tried changing them to Buttons to see if it would work but still no joy. Am I using the correct method for this? Should I just use ImageButtons altogether?

Here’s an example of me just testing it…

void NewLook::drawButtonBackground(Graphics& g, Button& button, Colour& backgroundColour, bool isMouseOverButton, bool isButtonDown) { g.setColour(Colours::hotpink); g.fillAll(); }

Thanks


#2

const Colour? Some compilers are very picky about matching constnass. (VS2005?)

void drawButtonBackground (Graphics& g,Button& button, const Colour& backgroundColour,
bool isMouseOverButton,
bool isButtonDown);


#3

const Colour? Some compilers are very picky about matching constnass. (VS2005?)

void drawButtonBackground (Graphics& g,Button& button, const Colour& backgroundColour,
bool isMouseOverButton,
bool isButtonDown);


#4

Yip that did it! Thanks Justin, don’t know how I missed that!


#5

Gets me all the time! usually for me its the trailing const!


#6

Doesn’t the C++0x specification have a new language feature specifically designed to help with this? I seem to recall something.


#7

yes, but optional
http://en.wikipedia.org/wiki/C%2B%2B0x#Explicit_virtual_function_overrides


#8

Yep thats it! Wow…that sure is some ugly syntax haha