ListColumn.WidthExpression

From Xojo Documentation

Property (As String )
aListColumn.WidthExpression = newStringValue
or
StringValue = aListColumn.WidthExpression

Supported for all project types and targets.

Column width as a string expression that can include the percent sign, a decimal point, or blanks.

Notes

Width can be specified as a value in pixels, a percentage, or a relative length. To obtain the absolute width of a column specified using percent or a relative length, call WidthActual. If you use * or %, the actual width will vary as the width of the ListBox changes.

Example

To set column widths, you can use a mixture of pixels, percentages, and relative lengths. Column widths specified in pixels are guaranteed to have the specified width with the user resizes the ListBox or resizable columns. Column widths specified in percentages are guaranteed to have that percentage of the visible width of the ListBox. The column widths specified using the "*" divide up the remaining width proportionally. Using the "*" as the last column width, assigns all of the remaining width to the last column. Resizing a column will resize the value of the expression. If you resize the ListBox, both the percentage and relative lengths recompute their actual widths. There are two resizing "modes"; for more information, see Resizing Columns in the documentation for the ListBox control.

For example, if there are three columns, the specification:

Listbox1.Column(0).WidthExpression = "3*"
Listbox1.Column(1).WidthExpression = "*"
Listbox1.Column(2).WidthExpression = "10"

allocates a fixed amount of space to Column(2). There remaining width is divided up into four segments and allocates it between Columns 0 and 1 in the ratio of 3 to 1. This means that Column(0) gets the width of the ListBox minus 10 times 3/4, Column(1) gets the width of the ListBox minus 10) times 1/4, and Column(2) gets 10 pixels. As the ListBox changes in size (due to a window resize, for example) columns 0 and 1 will change to reflect that growth, while column 2 will not.