ComboBox
class in package klyn.gui.windows

    public class ComboBox extends Widget:

Widget
└ ComboBox

Themed drop-down selection field.

The popup is painted in the window overlay pass so it floats above the existing layout without pushing following widgets down.

    combo = ComboBox()
    combo.addItem("Light")
    combo.addItem("Dark")
    combo.selectionChanged += lambda(e: ActionEvent): print(combo.text)
    combo.select(0)

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 readonly property | itemCount `itemCount as ULong:` | Number of available items.
public property | maxVisibleItems `maxVisibleItems as Int` | Maximum number of visible rows in the expanded inline list.
public property | paddingX `paddingX as Int` | Horizontal text padding.
public property | placeholder `placeholder as String` | Placeholder text displayed when nothing is selected.
public property | popupItemHeight `popupItemHeight as Int` | Height of one row in the expanded inline drop-down list.
public readonly property | selectedItem `selectedItem as String:` | Selected item text, or an empty string when nothing is selected.
public readonly property | text `text as String:` | Selected item text, or an empty string when nothing is selected.

Inherited Properties
property Inherited Properties from Widget: accentColor, backgroundColor, borderColor, bottom, canFocus, cornerRadius, cursor, font, foregroundColor, hasFocus, height, isEnabled, isHovered, isManaged, isTabStop, isVisible, layoutParams, margin, maxHeight, maxWidth, minHeight, minWidth, parent, preferredHeight, preferredWidth, resolvedStyleCache, resolvedStyleCacheAppearanceMode, resolvedStyleCacheFont, resolvedStyleCacheRevision, resolvedStyleCacheStateKey, resolvedStyleCacheStyleClass, resolvedStyleCacheZoomRevision, right, size, sizePolicy, styleClass, toolTip, width, window, x, y
Signals

Modifier and Type | Member | Description
--- | --- | ---
public signal property | selectedIndex `selectedIndex as Int:` | Currently selected item index, `-1` when there is no selection.

Events

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

Inherited Events
event Inherited Events from Widget: keyPressed, keyReleased, mouseMoved, mousePressed, mouseReleased, mouseWheel, paintRequested, resized
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 override | paintOverlay `paintOverlay(painter as Painter) as Void:` | Paints the popup list above the regular widget tree.
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.

Inherited Methods
method Inherited Methods from Widget: blur, containsPoint, emitKeyPressed, emitKeyReleased, emitMouseMoved, emitMousePressed, emitMouseReleased, emitMouseWheel, handleTabKey, notifyPaintRequested, paint, paintClipped, paintOverlay, repaint, requestFocus, resolvePreferredHeight, resolvePreferredWidth, resolvedFont, setBounds