I have created a Form1 and added a Label1 with the designer. Label1 has the following properties:
top = 50
left = 100
width = 50
height = 20
After that, I added this code:
B4X:
Sub Globals
End Sub
Sub App_Start
Form1.Show
AddLabel("Form1","Label2",50,Label1.Top,Label1.Width,Label1.Height,"Label2")
AddLabel("Form1","Label3",150,Label1.Top + 2,Label1.Width,Label1.Height,"Label3")
End Sub
If I start this code on the desktop, I can see (as shown in the attachment):
- Label1 is the reference
- Label2 is displaced (2 pixels HIGHER than Label1)
- Label3 has the same top position as Label1
If I start that code on the device I'll get the (estimated) result:
- Label1 is the reference
- Label2 has the same top position as Label1
- Label3 is displaced (2 pixels LOWER than Label1)
It looks like the designer created and the manually created labels don't have the same font size.
If you'll explicitly set the font size they should be properly aligned.
It will be fixed in the next update.
If you set the background colours different to that of the form you can see that the labels are all in the correct position, it is the position of the text within the added labels that is different.
A further peculiarity, on my system at least, is the the label added at design time with the default background colour has the same colour background as the form, whereas those added at runtime have a different, slightly darker background colour.