[SOLVED] JUCE_LIVE_CONSTANT and plugin

To auto-repaint the component, I had to change the JUCE code slightly…

In juce_LiveConstantEditor.cpp, the class method AllComponentRepainter::timerCallback() :

    void timerCallback() override
    {
        stopTimer();

        for (int i = Desktop::getInstance().getNumComponents(); --i >= 0;)
            if (Desktop::getInstance().getComponent(i))
                Desktop::getInstance().getComponent(i)->repaint();
    }

Rail

Hi Jules,

Your changes work except if there’s another (child) component on the component which is being updated… in that case the child component disappears. I don’t see that with my change.

Thanks,

Rail

The difference between your change and mine is just that mine also calls resized() and repaints recursively, whereas yours doesn't. Maybe there's something broken in your resized() method that's messing up?

Aah… yes…

I have a non-resizable “Dialog” Component A I use in my plugin which is used in place of a modal dialog which covers the main UI and has a child Component B the size of the dialog centered in the parent… and that has a child Component C which is centered horizontally in it’s parent. Since none of the Components are resizable I didn’t notice the order of the calls to resized weren’t in the order I expected: A::resized(), B::resized() then C::resized()… instead the order was B::resized(), C::resized() and then A::resized() (because B has a setSize() in it’s constructor). I fixed the problem simply enough by changing the getBounds() in B::resized() to getLocalBounds() and all things are good!

I would never have noticed or seen the problem if I hadn’t been using JUCE_LIVE_CONSTANT.

Thanks,

Rail