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. Field and list share one outline; the list opens upwards when necessary. The mouse wheel and arrow keys can reach items beyond the visible rows.

combo = ComboBox()
combo.addItem("Light")
combo.addItem("Dark")
combo.selectionChanged += lambda(e as 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
Whether the overlay list is open.
public readonly property itemCount
itemCount as ULong
Number of available items.
public property maxVisibleItems
maxVisibleItems as Int
Maximum visible rows; remaining items stay accessible by wheel or keys.
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
Logical height of one row in the expanded overlay list.
public readonly property popupTop
popupTop as Int
Top of the contiguous popup in window coordinates.
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
propertyInherited Properties from Widget: accentColor, acceptFileDrops, backgroundColor, borderColor, bottom, canFocus, cornerRadius, cursor, font, foregroundColor, hasFocus, height, isEnabled, isHovered, isManaged, isPressed, 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 Long
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
eventInherited Events from Widget: filesDropped, focusGained, focusLost, keyPressed, keyReleased, mouseMoved, mousePressed, mouseReleased, mouseWheel, paintRequested, resized
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 override applyThemeMetrics
applyThemeMetrics(fontPixelSize as Int, paddingLeft as Int, paddingTop as Int, paddingRight as Int, paddingBottom as Int) as Void
No summary.
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 popupContainsPoint
popupContainsPoint(x as Int, y as Int) as Boolean
Tests the same popup bounds used by painting and native input routing.
public select
select(index as Long) 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
methodInherited Methods from Widget: applyThemeMetrics, blur, containsPoint, emitFilesDropped, emitFocusGained, emitFocusLost, emitKeyPressed, emitKeyReleased, emitMouseMoved, emitMousePressed, emitMouseReleased, emitMouseWheel, handleTabKey, notifyPaintRequested, paint, paintClipped, paintForeground, paintOverlay, preferredSizeIncludesContentZoom, repaint, requestFocus, resolvePreferredHeight, resolvePreferredWidth, resolvedFont, setBounds