ComboBox
classin packageklyn.gui.windows
public class ComboBox extends 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)
Fields
Modifier and Type Member Description
public event selectionChanged
selectionChanged as ActionEvent
No summary.
Attributes inherited from Widget: keyPressed, keyReleased, mouseMoved, mousePressed, mouseReleased, mouseWheel, paintRequested, resized
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 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 signal 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, isTabStop, 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 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.
Methods inherited from Widget: blur, containsPoint, emitKeyPressed, emitKeyReleased, emitMouseMoved, emitMousePressed, emitMouseReleased, emitMouseWheel, handleTabKey, notifyPaintRequested, paint, paintOverlay, repaint, requestFocus, resolvePreferredHeight, resolvePreferredWidth, resolvedFont, setBounds