# DocumentWindows In Plugins

**URL:** <https://forum.juce.com/t/documentwindows-in-plugins/44426>\
**Category:** General JUCE discussion\
**Created:** [February 15, 2021, 2:52am UTC](https://forum.juce.com/t/documentwindows-in-plugins/44426 "2021-02-15T02:52:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jakemumu](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jakemumu/32/13038_2.png) [@jakemumu](https://forum.juce.com/u/jakemumu)\
**Post date:** [February 15, 2021, 2:52am UTC](https://forum.juce.com/t/documentwindows-in-plugins/44426/1 "2021-02-15T02:52:38Z")

</div>

I’ve been attempting to add a second window to my plugin by using a DocumentWindow inside of my plugin.

It appears to be working well although there are some slight hiccups like needing to always set the window on top and it stealing keystrokes from the host.

Anyone have experiences on some best practice tips while doing this?

---

<div class="post-metadata">

**Author:** ![ImJimmi](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/imjimmi/32/10843_2.png) [@ImJimmi](https://forum.juce.com/u/ImJimmi)\
**Post date:** [February 15, 2021, 10:21am UTC](https://forum.juce.com/t/documentwindows-in-plugins/44426/2 "2021-02-15T10:21:44Z")

</div>

I think the best practice is to not do it at all.

Plugins don’t create their own window, the host creates it and tells the plugin to draw itself within it. Creating extra windows is always going to be problematic.

If you really really want a second window, one workaround might be to simply add a Component to the desktop, similar to how popup menus work, and have it draw its own title bar.

---

<div class="post-metadata">

**Author:** ![jakemumu](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jakemumu/32/13038_2.png) [@jakemumu](https://forum.juce.com/u/jakemumu)\
**Post date:** [February 15, 2021, 4:16pm UTC](https://forum.juce.com/t/documentwindows-in-plugins/44426/3 "2021-02-15T16:16:19Z")

</div>

Yeah I agree that it’s not ideal but there are plugin which have pulled it off and I’ve gotten numerous request to break some panels out into multiple windows.

That’s an interesting idea though, I hadn’t tried adding a component directly to the desktop without using a toplevelwindow class I didn’t know that’s possible.

I’ll report back here how that behaves vs the typical document window approach

---

<div class="post-metadata">

**Author:** ![jakemumu](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jakemumu/32/13038_2.png) [@jakemumu](https://forum.juce.com/u/jakemumu)\
**Post date:** [February 16, 2021, 12:29am UTC](https://forum.juce.com/t/documentwindows-in-plugins/44426/4 "2021-02-16T00:29:01Z")

</div>

Alright I’ve got pretty desirable results with a DocumentWindow. The trick is to set the window to not get key focus, but then add the components you want to have hover actions etc inside of the component as mouseListeners against the entire desktop
