overtone/overtone — comment on commit c6d2436c8f7aa5950db29d47154cf30178d275dc
File:  line 0
By rosejn:

Oh nice, I didn't know about the behaviors. I'll switch to using this.

I really like the separation of creating the UI from one function, and then adding behaviors by using select and listen. The problem is that sometimes the behavior needs access to additional data for widgets it selects. For example, I have a horizontal-panel containing thumbnails of waveforms. When I select them in an add-behavior function, I also need to know the corresponding buffer for each thumbnail so I can switch the main waveform editor to show a new buffer. What about having widgets implement IAssociative, and then have access to arbitrary widget properties? So to get the buffers for my thumbnails I could do something like this:

(for [thumbnail (select root [:.thumbnail])]
[thumbnail (:buf thumbnail)])

Or maybe you have some ideas for different ways to do this?