Windows "Snap" feature

Couldn’t find much in the API or forums regarding Windows snap feature for applications. I am referring to the windows feature where an application will fill a certain region of the monitor and snap to that size.
Do other peoples stand-alone applications do this automatically? It seems like the type of thing JUCE would have some sort of interface for but it may be that I need to interact with the Windows API directly.

This isn’t an app feature, it’s an OS one - so yeah, it’s automatically handled if the Windows version supports it. If you hold the Windows key and press an arrow key with any app (that doesn’t override the shortcut) it will “snap.”

That’s what I thought but for some reason my application doesn’t do it not sure if I have mistakenly disabled it by setting re-size limits. There are no key bindings so I don’t think I have overwritten the shortcut…hmm

IIRC the Windows snap feature works “automatically” if you use a native titlebar. Not sure if this is the best route to achieve what you want, though.

If this is a workable solution, this thread has some solutions for how to modify the standalone plugin window.

2 Likes

Thank you will check it out!

Is anyone aware if its possible to get this working without the native titlebar? is it a case of rolling your own solution and handling the same key presses?

This is exactly what I’m trying to achieve. I’m sure it’s possible but may involve implementing your own document window class or interacting with the windows API. Working on something else at the moment and this is a relatively low priority so not sure when I will get to circle back but will update this thread when I do…Let me know if you find a good solution!

On the JUCE 8 branch, windows with JUCE titlebars (i.e. non-native) are now hooked up to the Windows NCHITTEST API. This means that things like “aero snap”, the flyout tiling menu that appears when hovering the maximise button, and double-clicking a horizontal edge of a window to maximise it vertically now all work the same way that they do for apps with native titlebars.

2 Likes

The above change turns out to have a few serious issues that make it unsuitable for production use. We’re reverting the change temporarily, to improve the stability of the JUCE 8 branch.

Once JUCE 8.0.0 has been released, we’ll resume development of this feature on the develop branch. It’s nearly there, but the polish is proving unexpectedly time-consuming!

1 Like