Plugin window position


#1

Is it possible to detect position and size changes of the plugin window. For example, if user moves plugin window in host to another location. I want to detect that, because i have another document window opened and i want to set its position accordingly.

Thx!


#2

I’m not sure, but did you try the ComponentListener on the PluginEditor component?


#3

It doesn’t work - as i understand this works only in case when the component that is being watched is moved relative to its top-level peer window - this is not the case here … or i am missing something ?!?


#4

Yes, it seems so, sorry… I tried also ComponentMovementWatcher, doesn’t do either (only inside JUCE).

The only thing I could come up with was using a Timer:

void timerCallback () override {
    Rectangle<int> b = getScreenBounds();
    if (b != oldBounds) {
        DBG ("Bounds: " + String (b.getX()) + "/" + String (b.getY()) + ":" + String (b.getWidth()) + "/" + String (b.getHeight()));
        oldBounds = b;
    }
}

But for instance in ProTools the Timer is calling very seldom during dragging, so that’s also not a satisfying solution…


#5

This one works perfect for my needs, thank you!!!