# Signals & slots in Juce

**URL:** <https://forum.juce.com/t/signals-slots-in-juce/15267>\
**Category:** General JUCE discussion\
**Created:** [August 7, 2015, 10:43pm UTC](https://forum.juce.com/t/signals-slots-in-juce/15267 "2015-08-07T22:43:00Z")\
**Posts on this page:** 3\
**Page:** 2

<div class="post-metadata">

**Author:** ![matkatmusic](https://avatars.discourse-cdn.com/v4/letter/m/dfb087/32.png) [@matkatmusic](https://forum.juce.com/u/matkatmusic)\
**Post date:** [May 30, 2017, 10:33pm UTC](https://forum.juce.com/t/signals-slots-in-juce/15267/21 "2017-05-30T22:33:16Z")

</div>

I have forgotten why I posted my original post (see post 2 in this thread), and now I don’t understand what your file does @jwezorek lol

---

<div class="post-metadata">

**Author:** ![jwezorek](https://avatars.discourse-cdn.com/v4/letter/j/0ea827/32.png) [@jwezorek](https://forum.juce.com/u/jwezorek)\
**Post date:** [May 30, 2017, 10:48pm UTC](https://forum.juce.com/t/signals-slots-in-juce/15267/22 "2017-05-30T22:48:23Z")

</div>

lol … yeah that happens. basically dont look at the implemenation, look at the usage. All of this is about doing what Qt does regarding the way it hooks a button click to a button click handler but without using code generation and without using a super heavy-weight mountain of C++ like boost::signals. The code I posted is a little confusing but it is (1) short and (2) at the end of the day just a wrapper around a list of std::functions.

---

<div class="post-metadata">

**Author:** ![matkatmusic](https://avatars.discourse-cdn.com/v4/letter/m/dfb087/32.png) [@matkatmusic](https://forum.juce.com/u/matkatmusic)\
**Post date:** [May 31, 2017, 3:32am UTC](https://forum.juce.com/t/signals-slots-in-juce/15267/23 "2017-05-31T03:32:19Z")

</div>

I seem to remember wanting to be able to do things like:

```auto
button.mouseDown = []() { DBG( "you clicked the button"); };
button.mouseEnter = []() { DBG( "you moused over the button"); };

```

but that was impossible with juce (hint hint @jules)  
so, this whole signal/slot thing came up so we could type:

```auto
delegate.connect( &button, Button::mouseDown, []() {DBG( "you clicked the button");} );
delegate.connect( &button, Button::mouseEnter, []() { DBG( "you moused over the button"); } );

```

which was still better than the whole `addListener(this)/buttonClicked(Button*)` system when you have a bunch of buttons in your GUI, but not as good as the first one.

somethin’ to consider…

```auto

```

[Previous page](https://forum.juce.com/t/signals-slots-in-juce/15267.md?page=1)
