B4J Question [ABMaterial] What does VerticalAlign do ?!

mindful

Active Member
Licensed User
@alwaysbusy VerticalAlign (True or False) is not about the position (top, bottom, center) is instead if we have multiple controls in one cell and the cell has VerticalAlign set to True then each control will be stacked vertically ? am I correct ?

And here comes the real question :) How do we center vertically a control (lets say an ABMLabel) inside a cell ? I am now using margins is there any other way ?


Later edit: VerticalAlign set to True stacks controls in a cell horizontally
 
Last edited:
Upvote 0

mindful

Active Member
Licensed User
I kind of figured out what the VerticalAlign does :)) So if you need to position an ABMCompoment in the center of one cell you need to do the following:
1. set the theme for that cell:
add this code in build theme
B4X:
    Theme.AddCellTheme("cellaligncentervalign")
    Theme.Cell("cellaligncentervalign").Align = ABM.CELL_ALIGN_CENTER
    Theme.Cell("cellaligncentervalign").VerticalAlign = True
    Theme.AddCellTheme("cellalignrightvalign")
    Theme.Cell("cellalignrightvalign").Align = ABM.CELL_ALIGN_RIGHT
    Theme.Cell("cellalignrightvalign").VerticalAlign = True
    Theme.AddCellTheme("cellalignleftvalign")
    Theme.Cell("cellalignleftvalign").Align = ABM.CELL_ALIGN_LEFT
    Theme.Cell("cellalignleftvalign").VerticalAlign = True
create the row and cell and provide the necesary theme to the cell
B4X:
Page.AddRows(1, False, "").AddCells12(1, "cellalignrightvalign")
2. set FixedHeight for that cell
B4X:
page.Cell(1,1).SetFixedHeight(100, False)
3. Add only one component to that cell and it will be center vertically ! if you add more than one components the will also be centered vertically but stacked horizontally one after the other, not one under the other.

In conclusion for the component to be veritcally centered in a cell that cell needs to have fixed height

hope this helps others ;)
 
Last edited:
Upvote 0
Top