Repository navigation
|
If you create a new layout, for example with 6 columns and 1 row, the cell expansion is default set to 1 divided by the number of columns/rows (0.16666667f). So when you put this layout in a larger cell, each column will expand and they all look the same. But when you insert a column into that same layout (to build dynamic GUIs), the expansion of that column is set to 0.0f and the default cell expansion is broken. For example an inserted column at index 1 will make this cell have no expansion and the last cell will absorb the surplus. My question is if this is intendent behavior?
Thanks a lot! |
Replies: 2 comments
|
Yes, that is the expected behavior. By default, the layout distributes the expansion percentage equally across all its cells. This has no effect on layouts that do not expand. However, in layouts that do expand, the expansion usually applies to only one or two cells; it is uncommon for a window to expand six widgets along the same horizontal or vertical axis. For this reason, each dynamically added column/row initializes its resize value to 0% so as not to alter the resize percentage of the other cells, which the user may have already set. When cells are removed, the resize percentage is normalized, as the total must always equal 1. Dynamically adding cells to layouts is not a common operation and is justified only in rare instances. Therefore, the programmer is responsible for adjusting the resize percentage whenever cells are added, based on the desired behavior within the layout. Use:
|
|
Thanks a lot for the explanation! |
Yes, that is the expected behavior.
By default, the layout distributes the expansion percentage equally across all its cells. This has no effect on layouts that do not expand. However, in layouts that do expand, the expansion usually applies to only one or two cells; it is uncommon for a window to expand six widgets along the same horizontal or vertical axis. For this reason, each dynamically added column/row initializes its resize value to 0% so as not to alter the resize percentage of the other cells, which the user may have already set.
When cells are removed, the resize percentage is normalized, as the total must always equal 1.
Dynamically adding cells to layouts is not a common oper…