Shouldnt DrawableButton paintButton() use getButtonText()?


#1

When the ImageAboveTextLabel is being used for DrawableButton the paintButton () code uses Button::getName() to display below the image.

ie:

g.drawFittedText (getName(),
2, getHeight() - textH - 1,
getWidth() - 4, textH,
Justification::centred, 1);

This seems wrong to me since getName() is the Name of a component which ought to be fixed once the button is instantiated regardless of what is shown on the button. TextButton uses Button::getButtonText() to define the caption. Shouldnt this apply to DrawableButton too ?


#2

Yes, you’re absolutely right! I’ll get that sorted out, thanks!


#3

cool.

pwhile on subject of DrawableButton :-

i am attempting to create my own “custom” version of
DrawableButton, so i created copies of DrawableButton.h and DrawableButton.cpp and renamed the source files and the names of the class from DrawableButton to “Bevel_Button” .

for the time being i simply left the new versions in the same directory as the
juce control source and added the two files to XCode. I then via macro - simply “pointed” an existing subclass of DrawableButton that i already had ( named “Bevelbutton”) , to Bevel_Button.

Even though i hadnt gotten around to doing any modifications to the code ( APART from renaming all the class names from “DrawableButton” to “Bevel_Button” when i do a build - i get a clean compile with no compile errors but some linker errors:

( the subclass that was previously inherited from DrawableButton compiled and linked fine with no errors.)

Undefined symbols:
“Bevel_Button::paintButton(juce::Graphics&, bool, bool)”, referenced from:
vtable for rbf::Bevelbuttonin RBclasses.o
vtable for rbf::CcTrack_bbEditVIin Colours.o
vtable for rbf::CcTrack_tbMutein Colours.o
vtable for rbf::CcTrack_tbSoloin Colours.o
vtable for rbf::WTest_bbIconBevelin Colours.o
vtable for rbf::WTest_bbEditVI1111in Colours.o
vtable for rbf::WTest_bbEditVI111in Colours.o
vtable for rbf::WTest_bbEditVI11in Colours.o
vtable for rbf::WTest_bbEditVI13121112in Colours.o
vtable for rbf::WTest_bbEditVI13121111in Colours.o
vtable for rbf::WTest_bbEditVI1312111in Colours.o
vtable for rbf::WTest_bbEditVI14111in Colours.o
vtable for rbf::WTest_bbEditVI1311111in Colours.o
vtable for rbf::WTest_bbEditVI131311in Colours.o
vtable for rbf::WTest_bbEditVI131211in Colours.o
vtable for rbf::WTest_bbEditVI1411in Colours.o
vtable for rbf::WTest_bbEditVI131111in Colours.o
vtable for rbf::WTest_bbEditVI13131in Colours.o
vtable for rbf::WTest_bbEditVI13121in Colours.o
vtable for rbf::WTest_bbEditVI141in Colours.o
vtable for rbf::WTest_bbEditVI13111in Colours.o
vtable for rbf::WTest_bbEditVI1313in Colours.o
vtable for rbf::WTest_bbEditVI1312in Colours.o
vtable for rbf::WTest_bbEditVI14in Colours.o
vtable for rbf::WTest_bbEditVI1311in Colours.o
vtable for rbf::WTest_bbEditVI131in Colours.o
vtable for rbf::WTest_bbEditVI13in Colours.o
"Bevel_Button::Bevel_Button(juce::String const&, Bevel_Button::ButtonStyle)", referenced from:
rbf::Bevelbutton::Bevelbutton()in RBclasses.o
rbf::Bevelbutton::Bevelbutton()in RBclasses.o
"typeinfo for Bevel_Button", referenced from:
typeinfo for rbf::Bevelbuttonin RBclasses.o
"Bevel_Button::setImages(juce::Drawable const*, juce::Drawable const*, juce::Drawable const*, juce::Drawable const*, juce::Drawable const*, juce::Drawable const*, juce::Drawable const*, juce::Drawable const*)", referenced from:
rbf::Bevelbutton::Set_Icon(rbf::Picture_*) in RBclasses.o
"Bevel_Button::~Bevel_Button()", referenced from:
rbf::Bevelbutton::~Bevelbutton()in RBclasses.o
rbf::Bevelbutton::~Bevelbutton()in RBclasses.o
rbf::Bevelbutton::~Bevelbutton()in Colours.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

since the only change to the header and body files were that i renamed the class to Bevel_Button i am totally stumped!!