Page 1 of 1

How to vertically align cells in a table?

Posted: Thu May 07, 2020 10:44 pm
by moon69
I want to center a row in a table (rather than center the cell content in the row).
The table has a minimal_height as shown by it's background image.
The minimal_height setting appears to affect the table but not the row.
The StyleSpecification.vertical_align affects the contents of the rows, but not the rows themselves.
LuaGuiElement.vertical_centering is set true for table, but tbh I'm not quite sure what a "field" is in a table? ...

Code: Select all

vertical_centering: Whether the fields of this table should be vertically centered.
StyleTest.png
StyleTest.png (185.36 KiB) Viewed 509 times
It looks to me like I need to set the minimal_height on the row.

Here is the relevant code...

Code: Select all

	local table_test1 = player.gui.center.add{
		type = "table", name = "table_test1", direction = "horizontal",
		column_count = 2, style = "test_table_style" }

	local testButton1 = table_test1.add{
		type = "button", name = "testButton1", caption = "Test1!" }

	local testButton2 = table_test1.add{
		type = "button", name = "testButton2", caption = "Test2!" }

Code: Select all

style.test_table_style =
{
  type = "table_style",
  parent = "table",
  vertical_align = "center",
  minimal_height = 100,
  background_graphical_set =
  {
    filename = "__StyleTest__/test600x250.png",
    width = 600,
    height = 250,
  },
}
What have I missed?

Attached is a simple test mod -just use the deconstruction planner to create the GUI.