Tables Always Auto-Size

From HLKitWiki
Jump to: navigation, search

Context: HL KitBasic Concepts and Terminology … Manipulation of Visual Elements … Working With Tables 

Tables perform very differently from other portals in terms of their sizing. All portals, including tables, are initially sized at the start of all positioning logic. However, tables will continue to automatically size themselves whenever you make changes to them.

Tables always maintain an integral height and width. This means that the table height is always an exact multiple of the height of the items it contains. It also means that the table width is always an exact multiple of the number of columns it contains. No items are ever partially displayed.

Whenever the size of a table is modified, everything is re-calculated for that table. If the specified dimensions are not an exact multiple of the width and/or height of individual items, then the size of the table is automatically shrunk to the next lower integral width and/or height. A table will never be larger than the dimensions assigned to it, but will often be smaller. The lone exception to this that a table will always be big enough to contain a single item. If you attempt to size a table to smaller than is required to display a single item, the table will be sized to show one item.

This auto-sizing behavior is critical to keep in mind when using scripts to optimally fit multiple tables within a layout. The downward adjustment of a table's dimensions by one pixel could result in an entire row or column being dropped from the table. As such, any time that you change the size of a table, you must be sure to retrieve its updated dimensions when positioning another portal relative to it.