B4J Question WindowHeight when zoomed

Didier9

Well-Known Member
Licensed User
Longtime User
It seems the MainForm.WindowHeight variable report incorrect values when Windows is set to zoom the display.
For instance, I have a UI application with a window height of 600. I have a pane of height 100 which I locate at the bottom of the window.
To locate the pane correctly at the bottom of the window I have to apply a fudge factor of 48dip as shown in the example below when the display zoom is set to 100 but if I zoom to 125%, the fudge factor must now be 40dip.

I would like not to have to fudge the fudge factor, unless there is a way to capture the zoom setting.

In the example below, the pane is moved when clicking the button because AppStart needs to complete before WindowHeight makes sense.

B4X:
Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Private xui As XUI
    Private Button1 As B4XView
    Private Pane1 As Pane
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("Layout1")
    MainForm.Show
    MainForm.WindowHeight = 600
End Sub

Sub Button1_Click
    xui.MsgboxAsync("Hello World!", "B4X")
    Pane1.Top = MainForm.WindowHeight - Pane1.height - 48dip ' 48dip for 100% zoom, 40dip for 125% zoom
End Sub
 

MicroDrie

Well-Known Member
Licensed User
Longtime User
I suspect you're mixing up a few things. I miss the influence of the screen resolution on the scale. I think this post [Solved] once again: dip an dpi will help you
 
Upvote 0
Top