Enablement problem

I have a series of meters on a component that are created in ascending order. As they’re created, each starts a timer, which is used to gather data and drive the meter.

Their parent component is on a tab, and to save CPU overhead and bandwidth, I’m enabling and disabling the meters as tabs are selected.

For efficency reasons, it’s important that these meters be created and enabled in the same order, so that their timers fire in the right sequence.

I’d like to enable the meters in ascending order, but it turns out that they’re enabled by Component::sendEnablementChangeMessage() in reverse order, which throws a spanner in the works. Is there a reason the loop in that function runs down instead of up? If there’s not, I’d happily override the method in my component subclass, except the function is private.

Is there a clever way around this problem, allowing me to designate the order in which child components are enabled without modifying juce code?

Not really, I can’t guarantee any kind of order in which that sort of thing happens, and it may change in future. In fact, the order in which timers get called may also change, so you shouldn’t write code that relies on that either.

If the order is important, why not use a single timer that calls each of your components in the correct order? That’d be a bit more efficient too.

Good advice. I’ll give that a whirl.