createEditorIfNeeded and setBounds problems

Not sure if I’m doing something wrong. But here’s the deal. I have created my Plugin editor with createEditorIfNeeded() and before I add to the GUI, I use setBounds to make it show in the middle of my GUI.

When I call addAndMakeVisible, it shows a blank square at the top-left, them it jumps to where I have set with setBounds. Is this a bug or something wrong I’m doing?

My project is a VST Plugin which is loading other plugins with the AudioProcessorGraph.

Windows - XP, I’m using Orion to test the VST DLL file.


It’s a heavyweight window - before you add it to your own component, it exists as a desktop window, so if you set its bounds, you’ll be moving it about on the desktop. Either make sure it’s not visible until you add it to your comp, or set its size afterwards.

Got it, I will figure it out, thanks Jules.


Strange, I can’t find where you are using another window during creation. All its been done is using the main component window and adding the VST window as a child of it. If I just use a Documentwindow, it works correctly, as its a new window. But I don’t know yet how to setup a new window inside my component. I will search a bit more…


I suggest to use Windows (if you are under Windows Os) APIs - something like movewindow.

Thanks bud. I was thinking about the same thing too, as the project I’m working right now is Windows only. The next project will be multi-platform but them I will handle things in a dif way. :wink:

Ok, now, I will just handle things in a dif way.


We had the same issue with jost, which is crossplatform.
So on the linux side we use XMoveWindow (that comes from X) and so on…
I already managed to do what you’re trying to achieve, and to “embed” plugins’ guis in juce components.
But, sorry, I will not give you the source, it’s kinda workInProgress()->maybeGonnaBuyLicense(true);

Hehe, no problem. :mrgreen:

Right now, for what I’m doing, its easy to fix, its just in a future project I will have to handle things in a dif way. :wink:


I really don’t think you’d need to resort to platform-specific hackery here - it sounds like a really straightforward problem.

It wouldn’t explicitly use a window - any component will create its own OS window if it needs to (its ComponentPeer). For a plugin, after the component creates its window, the window then gets put inside the host’s window.

When a component has an OS window attached to it, you can hide or move it just by moving the component - no need to go digging around for the native window handle.