Can I call Slider::mouseWheelMove from other Component?

Hello,
Can I call Slider::mouseWheelMove() inside other Component::mouseWheelMove() which is in other area of plugin window? Actually I already use it and it works fine for me, but it doesn’t work for my client, and I wonder why?

I work on graphic eq. I have sliders for each parameter, and for each freq I have handle on the chart, I can drag those chart to change freq and gain. And I implemented changing Q parameter by mouse wheel moving. The simplest solution seems to be when I enter mouse on chart handle and start rotating wheel than just call mySliderQ.mouseWheelMove();

So my code looks like that:

void MyHandleChartComponent::mouseWheelMove(const MouseEvent& e, const MouseWheelDetails& wheel)
{
    mySliderQ.mouseWheelMove(e, wheel);
}

Is that OK?

For any help great thanks in advance.

Best Regards

The usual solution is to change the parameter(s) (using beginChangeGesture+setValueNotifyingHost+endChangeGesture), and have the sliders use attachments to the parameters, which will then automatically update for you when the parameter(s) change.

you could define some lambda for the behaviour you want in the one component and let the other component trigger that on demand

Hello,
great thanks for all of your advices. But not sure if your advices mean my solution is wrong or not?

I would say it’s better to do it the way I suggested, especially if your solution is failing in at least one case.

1 Like

Thanks for your advice. You are right.

IMO components shouldn’t be handling this sort of thing - they should hand off the user input events to a mediator that can handle them. This means the component’s have no dependencies on each other and also don’t handle any business logic, they can focus on the front-end logic.