WebListBox
From Xojo Documentation
Supported Platforms Project Types: Web Platforms: macOS, Windows, Linux |
- For desktop applications, see ListBox.
A scrollable, multicolumn listbox control that is similar to the desktop Listbox control.
Events | |||||||||||||||||
|
Methods | |||||||||||||||||||||||
|
Notes
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.
Example
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
End If
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
Next
Next
// Set style for selected cell
Me.CellStyle(row, column) = SelectedCellStyle
See Also
DataSource, WebStyle, WebPicture classes