Recreating MidiKeyboardComponent mouse behavior

Hello Jucers

I'm trying to create a simplified MIDI keyboard with a custom look and feel. Since it doesn't appear that Juce's LookAndFeel allows this, I'm trying to make my own component from scratch. 

Basically I have a bunch of keys which are child components of my custom keyboard component. My keyboard component is listening to those child components for mouse events. So the desired behavior is this: when the mouse is being dragged out of one key and onto another, the old key's noteOff should be sent and the new key's noteOn should be sent. 

However as other forum posts of yore point out, when dragging from one component to another, the new component ignores the mouse (which is obviously desirable for a lot of situations, but not mine). I can trigger notes perfectly just using mouseEnter and mouseExit so long as I don't actually do any clicking (but that's pretty useless).

I've tried disabling setInterceptsMouseClicks for my keys, however that disables mouseEnter and mouseExit as well. Some old post recommended overlaying another transparent component on top of everything, but that seems a bit convoluted. 

Is there a simple, elegant way to do this that I'm missing? I've been staring at this problem for too long, so hoping one of you can trigger a light bulb for me. Thanks!


Hmm, well I guess I'm giving up on using components for my keys and will do this a more complicated way. 

I can think of a lot of cases where it would be useful for buttons and other components to be able to behave like this on a drag though ... pretty much any kind of step sequencer, drum machine, on-screen MIDI keyboard where you'd want to drag over a number of items to change their state. 

I've always just done that kind of thing like it's done in the midi keyboard comp - by watching mouse-moves and updating whatever state is involved manually. Can't really think of a way it could be done in a more generalised way, TBH.

ok, thanks Jules. If I have any ideas once I get a bit deeper in I'll let you know.