Hey all -

easy question here: I have a simple globalFocusChanged(Component * focusedComponent) function which works great, but seems to lose the names of sliders.

what I mean is that clicking on any slider triggers the function, but focusedComponent->getName() returns “n” … ?

Is this because the focus is dropping through to a child component (the slider pin, or some such)? And if so, what do I do to tell the Slider to respond to mouse clicks as the focused component instead of the pin without altering the functionality?

Why do you need to know when a slider gets focused? If you need to trigger some custom behaviour, wouldn’t it be better to write a custom subclass of slider?

But if you’re just trying to find the slider object, calling findParentComponentOfClass on the focused item would probably sort you out.

ahh … good thought. I’ll give that a run.

I’m using the focus changes for a midi learn function. The name of each component corresponds to the task it will perform (in human readable form). So users click on the item, and its name pops up “change volume, track one” along with the last midi command to be received.

If saved, this goes into an XML file (awesome how easy these are to handle with juce) … so that the commandmanager can load em up each time the program starts.