public class ComboBox extends Widget:
Themed drop-down selection field.
The current implementation provides the selection model and a painter-based rendering consistent with the built-in KSS themes. Native popup behaviour can be layered on top of the same API later.
combo = ComboBox()
combo.addItem("Light")
combo.addItem("Dark")
combo.selectionChanged += lambda(event: ActionEvent): print(combo.text)
combo.select(0)| Modifier and Type | Member | Description |
|---|---|---|
| public event | selectionChangedselectionChanged as Event |
No summary. |
| Modifier and Type | Member | Description |
|---|---|---|
| public property | arrowAreaWidtharrowAreaWidth as Int |
Width reserved for the drop-down indicator. |
| public property | isExpandedisExpanded as Boolean |
Visual expanded state used by future native popups. |
| public property | paddingXpaddingX as Int |
Horizontal text padding. |
| public property | placeholderplaceholder as String |
Placeholder text displayed when nothing is selected. |
| public property | selectedIndexselectedIndex as Int: |
Currently selected item index, `-1` when there is no selection. |
| public readonly property | selectedItemselectedItem as String: |
Selected item text, or an empty string when nothing is selected. |
| public readonly property | sizesize as ULong: |
Number of available items. |
| public readonly property | texttext as String: |
Selected item text, or an empty string when nothing is selected. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | addItemaddItem(value as String) as Void: |
Appends a new selectable item. |
| public | clearItemsclearItems() as Void: |
Removes all items and clears the current selection. |
| public | clearSelectionclearSelection() as Void: |
Clears the current selection. |
| public | collapsecollapse() as Boolean: |
Collapses the drop-down indicator. |
| public | expandexpand() as Boolean: |
Marks the drop-down indicator as expanded. |
| public | items | Returns the current item storage. |
| public override | paintpaint(painter as Painter) as Void: |
Paints the combo box with the active KSS style. |
| public | select | Selects an item by index. |
| public | setItems | Replaces the current content with the provided items. |
| public | toggleExpandedtoggleExpanded() as Boolean: |
Toggles the expanded indicator state. |