First of all, thank you for your answer. I'm afraid I need to explain my problem better.
Primarily, the 16:9 layout should fit both a 16:9 screen and a 4:3 screen.
In the case of 16:9, 1366/725 gives a ratio of 1.89.
In the case of 4:3, 1920/1280 gives a ratio of 1.54.
These values are not absolutely built into the layout, they only served me for understanding.
The designer script calculates with percentages. With different screen formats, distortions naturally occur on a 4:3 display if the app was created on a 16:9 display.
Now you could determine the current ratio on the device in the designer script during programme execution and "straighten out" these distortions by means of a calculation in the script itself.
With a large designer script (currently about 600 lines due to many elements and a complex app), it would then be very time-consuming to create approximately square shapes with the help of a ratio formula in the script.
With the amount of code, however, I don't want to create a second layout variant, which would then also have to be updated with every change.
So what can the solution look like? The actual task is to display an app in 16:9 format also in 16:9 format on a 4:3 display without distortion.
My approach is to adapt the shape definition of the app to the current display right at the start of the programme (app start in the main screen) because of the dimensions of the screen. In other words: the app is programmed in 16:9, on a 4:3 display the height of the shape is reduced and I save myself all the wild calculations with the ratio in the script because the form itself then has the format 16:9 on a 4:3 display.
I'm not quite 100% sure, but the following code showed decent results on various screens:
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
Dim PagesManager As B4XPagesManager
Dim PS As Screen = FX.PrimaryScreen
' shrinking width to 90% of the screen
Dim Width = PS.MaxX*.9 As Double
' calculating 16:9 height depending on shrinked width
Dim Height = Width*.56 As Double
' calculating ratio only for comparison
Dim Ratio = Height/Width As Double
Log ("Ratio : " & Ratio)
' calculating gap to screen top/bottom for defining top of app
Dim Gap = (PS.MaxY-Height)/2 As Double
MainForm.BackColor = FX.Colors.Transparent
' centering left/right
MainForm.WindowLeft = PS.MinX + PS.MaxX*.05
' setting formwidth
MainForm.WindowWidth = Width
' setting top of form
MainForm.WindowTop = PS.MinY + Gap
' setting formheight
MainForm.WindowHeight = Height
' limitation of downsizing the form below 75%
MainForm.SetWindowSizeLimits(MainForm.WindowWidth*.75, MainForm.WindowHeight*.75, MainForm.WindowWidth, MainForm.WindowHeight)
PagesManager.Initialize(MainForm)
MainForm.Show
End Sub