ComboBox
classin packageklyn.gui.windows
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.select(0)
Properties
| Modifier and Type |
Member |
Description |
| public property |
arrowAreaWidth |
Width reserved for the drop-down indicator. |
| public property |
isExpanded |
Visual expanded state used by future native popups. |
| public property |
paddingX |
Horizontal text padding. |
| public property |
placeholder |
Placeholder text displayed when nothing is selected. |
| public property |
selectedIndex |
Currently selected item index, `-1` when there is no selection. |
| public readonly property |
selectedItem |
Selected item text, or an empty string when nothing is selected. |
| public readonly property |
size |
Number of available items. |
| public readonly property |
text |
Selected item text, or an empty string when nothing is selected. |
Properties inherited from Widget: accentColor,
backgroundColor,
borderColor,
bottom,
canFocus,
cornerRadius,
font,
foregroundColor,
hasFocus,
height,
isEnabled,
isHovered,
isManaged,
isVisible,
layoutParams,
margin,
maxHeight,
maxWidth,
minHeight,
minWidth,
parent,
preferredHeight,
preferredWidth,
right,
styleClass,
width,
window,
x,
y
Constructors
| Modifier and Type |
Member |
Description |
| public |
ComboBox |
No summary. |
Methods
| Modifier and Type |
Member |
Description |
| public |
addActionListener |
Registers a listener notified when the selection changes. |
| public |
addItemaddItem(value as String) as Void: |
Appends a new selectable item. |
| public |
clearItems clearItems() as Void:
|
Removes all items and clears the current selection. |
| public |
clearSelection clearSelection() as Void:
|
Clears the current selection. |
| public |
collapse |
Collapses the drop-down indicator. |
| public |
expand |
Marks the drop-down indicator as expanded. |
| public |
items |
Returns the current item storage. |
| public override |
paint |
Paints the combo box with the active KSS style. |
| public |
removeActionListener |
Unregisters a previously registered selection listener. |
| public |
select |
Selects an item by index. |
| public |
setItems |
Replaces the current content with the provided items. |
| public |
toggleExpanded |
Toggles the expanded indicator state. |