# ResizableWindow::restoreWindowStateFromString repro'ed error

**URL:** <https://forum.juce.com/t/resizablewindow-restorewindowstatefromstring-reproed-error/7931>\
**Category:** General JUCE discussion\
**Created:** [December 29, 2011, 7:39pm UTC](https://forum.juce.com/t/resizablewindow-restorewindowstatefromstring-reproed-error/7931 "2011-12-29T19:39:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomswirly](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/tomswirly/32/236_2.png) [@tomswirly](https://forum.juce.com/u/tomswirly)\
**Post date:** [December 29, 2011, 7:39pm UTC](https://forum.juce.com/t/resizablewindow-restorewindowstatefromstring-reproed-error/7931/1 "2011-12-29T19:39:57Z")

</div>

Unlike my last two problems, in this case I can narrow the issue down to a few lines of code.

When I save and restore a window state, the window is restored as being entirely on the screen, even if it was partially off the screen before.

The issue is juce\_ResizableWindow.cpp:551-557. If the new size of the window does not entirely fit on the screen, the screen is resized so it entirely fits in the window.

This conflicts with the code in juce\_ComponentBoundsConstrainer.cpp, which allows (by default) most of the window to be off screen to the bottom, left or right, and it means that you can drag a window to a place that you can’t store and recall.

I fixed things for my purposes by merely commenting out those lines in juce\_ResizableWindow.cpp but I suspect something more nuanced is needed as a general fix!

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [December 31, 2011, 12:10pm UTC](https://forum.juce.com/t/resizablewindow-restorewindowstatefromstring-reproed-error/7931/2 "2011-12-31T12:10:29Z")

</div>

Interesting - I think I probably meant to check whether the window was entirely off-screen before snapping it back on, rather than just seeing whether any part of it was off-screen. Thanks, I’ll tweak that.

---

<div class="post-metadata">

**Author:** ![tomswirly](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/tomswirly/32/236_2.png) [@tomswirly](https://forum.juce.com/u/tomswirly)\
**Post date:** [December 31, 2011, 6:15pm UTC](https://forum.juce.com/t/resizablewindow-restorewindowstatefromstring-reproed-error/7931/3 "2011-12-31T18:15:34Z")

</div>

No problemo, señor - it was a) a tiny bug b) quick to find c) a quick fix.
