B4J Question Problems with scaling and positioning form elements in the window

VB6_man

Member
I'm having problems with the dimensions of form elements when scaling a window. When I just start the program, the dimensions are wrong, when I scale the window, the resize event is triggered and everything becomes correct, but I call the same event(MainForm_Resize) when the program starts(AppStart).
Also, when I open the window in full screen mode, all the elements are positioned completely wrong.


B4X:
Private Sub MainForm_Resize (Width As Double, Height As Double)
    MenuBar1.Top=0
    MenuBar1.Left=0
    
    CodeArea1.EditTop(MenuBar1.Height)
    CodeArea1.EditLeft(0)
    CodeArea1.SetEditSize(Width*0.8, Height*0.6)
    
    TreeView1.Top = MenuBar1.Height
    TreeView1.Left=CodeArea1.GetWidth
    TreeView1.SetSize(Width-CodeArea1.GetWidth,Height-MenuBar1.Height)

    TextArea1.Top=CodeArea1.GetHeight+MenuBar1.Height
    TextArea1.Left=0
    TextArea1.SetSize(Width-TreeView1.Width,Height - CodeArea1.GetHeight - MenuBar1.Height)
End Sub
 

Attachments

  • Снимок3.PNG
    Снимок3.PNG
    14.7 KB · Views: 123
  • Снимок2.PNG
    Снимок2.PNG
    9.5 KB · Views: 124
  • Снимок1.PNG
    Снимок1.PNG
    10.6 KB · Views: 119

VB6_man

Member
How to make the application adapt to devices with different screens in the constructor, and to resize the form by the user? I tried all combinations of windows and settings. More than several windows on one form cannot be mutually coordinated.
What am I missing?
 
Upvote 0
Top