Setting the size of grid rows and columns

x::w::gridlayoutmanager layout=container->get_layoutmanager();

layout->requested_col_width(1, 100);

When a nested container gets sized to be wider than its natural width, the nested container's grid layout manager attempts to expand all the columns' width evenly, to fill in the extra space. requested_col_width(col, percentage) instructs the grid layout manager that column #col should take up the given percentage of the total width of the container, as much as possible (the leftmost column in the grid is column #0).

If there's extra width available, the grid layout manager attempts to use the extra space to grow the columns to their requested size. The grid layout manager never makes columns shorter than their minimum size. For example, requested_col_width(1, 100); requests 100% of the total width for column #1. Of course, the grid also has column #0, and perhaps other columns. They have to take up some of the horizontal real estate. The end game is that column #1 takes whatever extra space there's left. Requesting 100% for a column is a roundabout way of making the column use all its extra space.

More than one column may have a set width. The grid layout manager attempts to use the extra space to fatten up all the requested columns. If there's still additional space left it gets divided amongst all other columns.

There's also a requested_row_height() that works similarly for any extra vertical real estate.


insert_row(), append_row() and remove_row() do not adjust the specified row heights. If, for example, a requested height gets set for row #5, and remove_row(3) removes row #3 from the grid, the grid's requested height for row #5 is still in place. However row #5 in the grid was the former row #6. After removing row #3, all subsequent rows move up a notch.


remove_col_defaults() unsets the requested width for the given column, if any, together with all other column settings, returning the column to its default width, and other properties. remove_row_defaults() unsets the requested height for the given row, if any, together with all other row settings, returning the row to its default width, and other properties.