Under Windows 11 there is the new snap layouts feature, that allows the user to snap a layout to a pre-defined place/size.
In JFX this works out of the box with a Decorated Form... But, how to call that feature programmatically when designing our own decorations in a TRANSPARENT form?
Not sure if it's the same thing, I haven't seen Windows 11. But windows 10 has a snap to area as well. I simulated that in my Replacement Titlebar library. It may help if you want to look at it.
Not sure if it's the same thing, I haven't seen Windows 11. But windows 10 has a snap to area as well. I simulated that in my Replacement Titlebar library. It may help if you want to look at it.
Ahh OK, no not seen that. You could still use a popup with the template and calculate the size required. But if the drop points are user defined, You may not be able to read them from the OS.
And the thing that is missing from the Titlebar is selecting the other windows to reposition. For example when the window is dropped in a 'half screen' position Windows allows you to choose another window to fill the other half.
Theoretically you could use the JNA to get a list of all of the windows and allow selection of the windows to position as appropriate, but is it really worth it?
Yes, that is what the link I posted is using. There is no Jar library file, so it would have to be re-written in B4x using JavaNativeAccess (JNA) , not a particularly easy task though.
I'm putting off migrating to windows 11, my 5 (maybe nearer 6) year old PC won't run it. It does everything else perfectly so I'm reluctant to spend £600-1000 just because Microsoft says I should. I'll have to do it eventually, maybe next year when support stops. Then perhaps, I'll have a look.
1, Create your undecorated form
2, Add a pane to hold a button (maximize)
3, Set the pane to non visible
4, Set a mouseover event to pane to show buttons when mouse is inside pane
5, Handle the maximize event - ths should trigger the snap layout
6, When mouse leaves pane - hide it again.
The main usage would be to be able to "snap to layout" with a custom Title bar, but for it to work, the button must be "registered" as a Max/Restore button, but that has given me and idea... just as B4XPages gets the native events delegated to it, could we delegate a button to a native event??
Guess I'll have to try that!