When I change the resolution of my display, using windows config, all open windows (non B4J) automatically adjust their sizes according to the new resolution, except my form created in b4j. I need the form I created also changes its size proportionally to the chosen resolution.
I thought this would happen automatically, no code required.
You're right.
I bought a 4k monitor, and what is happening is that when I switch to higher resolutions, windows is changing the DPI.
But all windows change their scales, except the forms created in B4J.
I'll try some compatibility modes...
Also something else to look at, if I drag a window to my second screen, it stays roughly the same size even though one res is 1600x900, and the other is 3840x2160. The reason - windows added a % scale to the second screen (in display settings). Setting the scale back to 100% for the second screen makes the window shrink as it crosses the screen division.
You're right.
The scale was at 200% ...
I changed it to 100% and everything is right now.
Just in case, I also used the @Daestrum suggestion.
Thank you all.
Dim jo As JavaObject
jo.InitializeStatic("java.awt.Toolkit")
jo = jo.RunMethodJO("getDefaultToolkit",Null)
Dim ScreenX As Int = jo.RunMethodJO("getScreenSize",Null).RunMethod("getWidth",Null)
Dim ScreenY As Int = jo.RunMethodJO("getScreenSize",Null).RunMethod("getHeight",Null)
Log($"Screen Resolution = ${ScreenX} x ${ScreenY}"$)
But ... You will get a warning... which in this thread @Erel says is OK and to ignore. If it is any different I am sure he will advise.
Today I received this report, but the Application works correctly Waiting for debugger to connect... Program started. Resize Map Panel. Map not initialized Alert: loadMapLibrary mapLibraryLoaded! Alert: !!!mapLibraryLoaded!!! WARNING: An illegal reflective access operation has occurred...
I found this, which adds an important part to solving of the problem - SCALE
SCREEN DIMENSIONS:
MyScale = GetDeviceLayoutValues.Scale 'divide this into height and width it seems 'This was 2 in my case
Log ("Scale = " & MyScale)
MyHeight = GetDeviceLayoutValues.Height This was twice the width of the Phone
Log ("Height = " & MyHeight
MyWidth = GetDeviceLayoutValues.Width This was twice the height of the phone
Log ("Width = " & MyWidth
SCALE gave me a variable to divide into the Height and Width to normalise the size when working with DIP