ComboBox
class in package klyn.gui.windows

    public class ComboBox extends Widget:

Widget
└ ComboBox

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)

Fields

Modifier and Type | Member | Description
--- | --- | ---
public event | selectionChanged `selectionChanged as Event` | No summary.

Properties

Modifier and Type | Member | Description
--- | --- | ---
public property | arrowAreaWidth `arrowAreaWidth as Int` | Width reserved for the drop-down indicator.
public property | isExpanded `isExpanded as Boolean` | Visual expanded state used by future native popups.
public property | paddingX `paddingX as Int` | Horizontal text padding.
public property | placeholder `placeholder as String` | Placeholder text displayed when nothing is selected.
public property | selectedIndex `selectedIndex as Int:` | Currently selected item index, `-1` when there is no selection.
public readonly property | selectedItem `selectedItem as String:` | Selected item text, or an empty string when nothing is selected.
public readonly property | size `size as ULong:` | Number of available items.
public readonly property | text `text as String:` | 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, sizePolicy, styleClass, width, window, x, y
Constructors

Modifier and Type | Member | Description
--- | --- | ---
public | ComboBox `ComboBox():` | No summary.

Methods

Modifier and Type | Member | Description
--- | --- | ---
public | addItem `addItem(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 `collapse() as Boolean:` | Collapses the drop-down indicator.
public | expand `expand() as Boolean:` | Marks the drop-down indicator as expanded.
public | items `items() as ArrayList<String>:` | Returns the current item storage.
public override | paint `paint(painter as Painter) as Void:` | Paints the combo box with the active KSS style.
public | select `select(index as Int) as Boolean:` | Selects an item by index.
public | setItems `setItems(values as List<String>) as Void:` | Replaces the current content with the provided items.
public | toggleExpanded `toggleExpanded() as Boolean:` | Toggles the expanded indicator state.

Methods inherited from Widget: blur, containsPoint, paint, repaint, requestFocus, resolvePreferredHeight, resolvePreferredWidth, resolvedFont, setBounds