Android Question Bug: [Designer Scripts] tab causes Label to reposition

JohnD

Active Member
Licensed User
Longtime User
When I click on the [Designer Scripts] tab Label2 moves and is covered by Label3/Panel3. I do have a script for this screen. However, the scaling code scales and moves Label2 exactly the same as Panel2. Panel2 does not move in this way. I included the main.bal file that the behavior occurs in. This bug occurs in both v2.71 and v3.0.
 

Attachments

  • main.bal
    6.3 KB · Views: 208

klaus

Expert
Licensed User
Longtime User
You should use this code:
B4X:
Panel1.SetLeftAndRight(0, 100%x)
Panel1.SetTopAndBottom(0, Panel2.Top)
Label1.SetLeftAndRight(80%x, 100%x)
Label1.SetTopAndBottom(0, Panel1.Height)

Panel2.SetLeftAndRight(0, 100%x)
Panel2.SetTopAndBottom(Panel1.Bottom, Panel3.Top)
Label2.SetLeftAndRight(0, 100%x)
Label2.SetTopAndBottom(0, Panel2.Height)

Panel3.SetLeftAndRight(0, 100%x)
Panel3.SetTopAndBottom(Panel2.Bottom, Panel4.Top)
Label3.SetLeftAndRight(0, 100%x)
Label3.SetTopAndBottom(0, Panel3.Height)

The Label positions are referenced to their parent Panel.
So if you want a Label's upper left corner positioned in the upper left corner of its parant panel the Left and Top properties of the Label must be 0 !
Be careful with:
Panel2.SetTopAndBottom(Panel1.Bottom, Panel3.Top)
You set the Panel2.Bottom to Panel3.Top
and then with
Panel3.SetTopAndBottom(Panel2.Bottom, Panel4.Top)
you set Panel3.Top to Panel2.Bottom.
You have across referencing which could give you bad results in other cases.
 
Upvote 0
Top