# Problem on DrawableButton click?

**URL:** <https://forum.juce.com/t/problem-on-drawablebutton-click/13489>\
**Category:** General JUCE discussion\
**Created:** [September 3, 2014, 6:31am UTC](https://forum.juce.com/t/problem-on-drawablebutton-click/13489 "2014-09-03T06:31:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![phil](https://avatars.discourse-cdn.com/v4/letter/p/e95f7d/32.png) [@phil](https://forum.juce.com/u/phil)\
**Post date:** [September 3, 2014, 6:31am UTC](https://forum.juce.com/t/problem-on-drawablebutton-click/13489/1 "2014-09-03T06:31:19Z")

</div>

When I try to trigger an action on a click on a DrawableButton, buttonClicked gets never called (I have ImageButtons triggering correctly the buttonClicked method in the same class). I tried both&nbsp;setClickingTogglesState (false) and&nbsp;setClickingTogglesState (true).

Am I doing something wrong ? Here is the code:

```
playButton = new DrawableButton("PlayButton",DrawableButton::ImageFitted);

        addAndMakeVisible(playButton);

        playButton->setImages(Drawable::createFromImageData(BinaryData::play_png, BinaryData::play_pngSize),nullptr,nullptr,nullptr,Drawable::createFromImageData(BinaryData::play_on_png, BinaryData::play_on_pngSize),nullptr,nullptr,nullptr);

        playButton->setClickingTogglesState (false); playButton-\>setColour(DrawableButton::backgroundOnColourId, Colour (0x00000000));
```

Thanks.

---

<div class="post-metadata">

**Author:** ![haydxn](https://avatars.discourse-cdn.com/v4/letter/h/5fc32e/32.png) [@haydxn](https://forum.juce.com/u/haydxn)\
**Post date:** [September 3, 2014, 6:37am UTC](https://forum.juce.com/t/problem-on-drawablebutton-click/13489/2 "2014-09-03T06:37:20Z")

</div>

If that snippet is complete, then the problem is probably the fact that you haven't added your listener to the button.

---

<div class="post-metadata">

**Author:** ![phil](https://avatars.discourse-cdn.com/v4/letter/p/e95f7d/32.png) [@phil](https://forum.juce.com/u/phil)\
**Post date:** [September 3, 2014, 7:22am UTC](https://forum.juce.com/t/problem-on-drawablebutton-click/13489/3 "2014-09-03T07:22:00Z")

</div>

You are right... duhh....
