B4J Question Anchor problem

panagiotisden2

Active Member
Licensed User
Longtime User
screenshot.png


hello, i have this strange behavior from the designer, this is a pane where i have some items in it. the whole pane is copy and pasted from another layout and the button was added later. the button(as well as the other two labels and the textfield) has anchor 'both' for left and right and 'top' for top and bottom but when compiling its in the top left corner(also tried with 'bottom' anchor for this button but nothing changes).

also the two labels in the bottom right are switched up for some reason (and they as well have anchors bottom-right). Getting the label1 higher from label2 acts as i never moved it and keeps appearing below the label2.

Thank you
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Moved to the questions forum.

There are two variants in the layout file. Remove the second one.

Note that it is a mistake to set the anchor to BOTH on a small view in the center. This will cause the view to disappear if the parent becomes a bit thinner.

You should instead set its position with the designer script:
B4X:
Button2.HorizontalCenter = Pane1.Width / 2
 
Upvote 0

panagiotisden2

Active Member
Licensed User
Longtime User
Moved to the questions forum.

There are two variants in the layout file. Remove the second one.

Note that it is a mistake to set the anchor to BOTH on a small view in the center. This will cause the view to disappear if the parent becomes a bit thinner.

You should instead set its position with the designer script:
B4X:
Button2.HorizontalCenter = Pane1.Width / 2
Thank you a lot Erel, that was it.
 
Upvote 0
Top