B4J Question [ABMaterial] TextAlign BUG?

Cableguy

Expert
Licensed User
Longtime User
Hi Alain,

Seems like none of the TextAlign constants seem to work with TextFields, like Labels.

Here's my code:

in the Page...
B4X:
Dim UserInfoLabel1 As ABMLabel
    UserInfoLabel1.Initialize(page,"user_info_label_1", "First Name :", ABM.SIZE_SMALL, False, "LeftUserInfoLabel")
    UserProfileFormLeftSubContainer.Cell(1,1).AddComponent(UserInfoLabel1)

and in BuildTheme...
B4X:
    MyTheme.AddLabelTheme("LeftUserInfoLabel")
    MyTheme.Label("LeftUserInfoLabel").Align = ABM.TEXTALIGN_RIGHT
 

alwaysbusy

Expert
Licensed User
Longtime User
It looks like the tag <small> can not do it: ABM.SIZE_SMALL. reason, it has no full cell width like for example a <p> or a <h1> have.

Two possibilities:

1. Change the size
2. Set it on cell level:

B4X:
theme.AddCellTheme("right")
theme.Cell("right").Align = ABM.CELL_ALIGN_RIGHT

Dim UserInfoLabel1 As ABMLabel
UserInfoLabel1.Initialize(page,"user_info_label_2", "First Name :", ABM.SIZE_SMALL, False, "")
page.Cell(1,1).UseTheme("right")  ' or do it in the grid declaration
page.Cell(1,1).AddComponent(UserInfoLabel1)

As a side note: do NOT use _ in the ID names, it can cause troubles that are very hard to track once your page comes complex.
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
It looks like the tag <small> can not do it: ABM.SIZE_SMALL. reason, it has no full cell width like for example a <p> or a <h1> have.

Two possibilities:

1. Change the size
2. Set it on cell level:

B4X:
theme.AddCellTheme("right")
theme.Cell("right").Align = ABM.CELL_ALIGN_RIGHT

Dim UserInfoLabel1 As ABMLabel
UserInfoLabel1.Initialize(page,"user_info_label_2", "First Name :", ABM.SIZE_SMALL, False, "")
page.Cell(1,1).UseTheme("right")  ' or do it in the grid declaration
page.Cell(1,1).AddComponent(UserInfoLabel1)

As a side note: do NOT use _ in the ID names, it can cause troubles that are very hard to track once your page comes complex.

I have tried Cell level, and it shifts the cell to the right… in my case the text = "First Name:" becomes ":First Name".
I also have tried changing the text size and it seems to not work too!

Changing Text size works
 
Last edited:
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
Tried both, and here they do work, so no idea then...

1st is size
2nd is cell

both without an _ in the ID

upload_2019-5-30_17-38-58.png
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
OK THEN... as Always, the master was right!

I would have sworn I had tried it, but i came to understand that I was trying to define the theme in the label.initialize method, while trying to set a cell theme!
"serves you right"! 'loud thinking'
 
Upvote 0
Top