B4J Question Undecorated and Snap Layouts

Cableguy

Expert
Licensed User
Longtime User
Hi guys,

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?
 

Cableguy

Expert
Licensed User
Longtime User
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.
Actually I'm refering to this:
1695984406737.png

This is a sort of "context pop-up" when hovering the Restore/Maximize buttons
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
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?
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Upvote 0

stevel05

Expert
Licensed User
Longtime User
I did find this, that targets exactly this case scenario of a custom title bar
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.
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
So... it is possible, just not easy!
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Now... do we have any JNA experts among us?
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Almost a year now has passed by....
No one up to the challenge.....(?)
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
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.
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Thanks for replying... if you ever need a tester, give me a shout
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
Not tried but it might work.

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.
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
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!
 
Upvote 0
Top