From Xojo Documentation
Supported PlatformsProject Types: Web Platforms: macOS, Windows, Linux
- For desktop applications, see ListBox.
A scrollable, multicolumn listbox control that is similar to the desktop Listbox control.
The WebListBox provides many of the features of the desktop Listbox.
Use the CellStyle and ColumnStyle methods to add style information to selected cells and/or columns. This is the way to change the borders, font size and style, background, opacity, and other styling attributes of WebListboxes. See the WebStyle entry for more information on the features that can be added via Web Styles.
This example adds 100 rows to a 5-column listbox:
If you want to select individual cells in the ListBox, you can do so using WebStyles. First, create a WebStyle (call it SelectedCellStyle) and set its Background to blue and its Text Color to white (or other colors of your own choosing).
In the SelectionChanged event handler for the ListBox, disable the selected row to prevent the selection from hiding the cell style:
// Turn off row selection to allow cell style to appear
Me.Selected(Me.ListIndex) = False
In the CellClick event handler, apply the SelectedCellStyle to the cell that was clicked:
For r As Integer = 0 To Me.RowCount - 1
For c As Integer = 0 To Me.ColumnCount - 1
Me.CellStyle(r, c) = Nil
// Set style for selected cell
Me.CellStyle(row, column) = SelectedCellStyle