DesktopListBoxColumn

From Xojo Documentation

Class (inherits from Object)


New in 2021r3

Used to refer to a particular column in a DesktopListBox via its ColumnAttributesAt property.

Properties
MaxWidthActual MinWidthExpression WidthExpression
MaxWidthExpression UserResizable
MinWidthActual WidthActual

Notes

Use the UserResizable property to set the property, e.g.,

ListBox1.ColumnAttributesAt(1).UserResizable = False

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 DesktopListBox or resizable columns. Column widths specified in percentages are guaranteed to have that percentage of the visible width of the DesktopListBox. 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 DesktopListBox control.

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

Listbox1.ColumnAttributesAt(0).WidthExpression = "3*"
Listbox1.ColumnAttributesAt(1).WidthExpression = "*"
Listbox1.ColumnAttributesAt(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 DesktopListBox 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 DesktopListBox 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.

Header End caps are added for any additional unused space if headers are used. Header end caps do nothing when clicked.

If the string expression passed to WidthExpression, MinWidthExpression, or MaxWidthExpression cannot be evaluated to a width or a percentage width, an UnsupportedFormatException will occur. The Message property of this exception describes in English what went wrong.

Examples

The following line in the Opening event of a DesktopListBox makes all the columns in the DesktopListBox resizable:

Me.Column(-1).UserResizable = True

The following line sets the maximum width of the first column in a DesktopListBox to 75% of the total width of the ListBox.

Listbox1.Column(0).MaxWidthExpression = "75%"

See Also

DesktopListBox class.