B4J Question Label Alignment issue

ilan

Expert
Licensed User
Longtime User
hi

could it be that the alignment in the designer is not working probably?
if i set the label alignment to TOP_RIGHT the text is still on TOP_LEFT.

its a long text and in hebrew. i tried to check "WRAP" option and not use CRLF inside the text but still the same.

thanx
 
Last edited:

emexes

Expert
Licensed User
Disclaimer: Just throwing ideas into the mix in case one of them sparks a solution; when a better answer is posted, go with that instead ;-)

There are other labels on the screen where it looks like the right-set alignment is working - what happens if you make a copy of one of those, and paste the text from the not-working label into it? Or select the entire array and make sure that it is all formatted as the tight-to-left font. Or maybe it depends on which is done first: the align-to-right, or the using a right-to-left font.

Also, the right edge of the label above the Facebook/Twitter/??? icons doesn't look very straight - it's almost like it's been aligned by adding spaces at the (left side) start of the lines. That might be a clue that the alignment hasn't worked previously, and isn't a new problem with a new update or something.
 
Upvote 0

jmon

Well-Known Member
Licensed User
Longtime User
I get the same problem as you. Even setting
B4X:
Label1.Alignment = "TOP_RIGHT"
does not give the expected behavior

You can set the "Extra CSS" to
B4X:
-fx-text-alignment: right;
to make it work

There are other labels on the screen where it looks like the right-set alignment is working
The expected behavior works for labels with 1 line of text.

For more than one line of text, I guess the inner block of text is aligned to the right of the label size, but the text is not aligned to the right. This text alignment has to be done in css.


Edit: (to clarify)
I imagine that the label is a bit like a hBox? There seems to be a Text node inside the label, and that Text node is aligned to the right or not. The label computes the width of the Text node, and align it within its boundaries. So in order to modify the alignment of the Text of the Text node, it has to be done via css.
That's what seems to be the only reason for this behavior
 
Last edited:
Upvote 0

jmon

Well-Known Member
Licensed User
Longtime User
i guess i have to do that inside my code.
You can set it directly in the designer at "Extra CSS":
Capture.PNG
 
Upvote 0
Top