comboBox
Text entry widget with dropdown choices.
Call ComboBox.entries after this with the choices.
Only valid between Window.beginand Window.end.
Parameters
- src:std.builtin.SourceLocation
- std.builtin.SourceLocation
- init_opts:TextEntryWidget.InitOptions
- TextEntryWidget.InitOptions
- opts:Options
- Options
Source
Implementation
pub fn comboBox(src: std.builtin.SourceLocation, init_opts: TextEntryWidget.InitOptions, opts: Options) *ComboBox {
const combo = widgetAlloc(ComboBox);
combo.te = widgetAlloc(TextEntryWidget);
combo.te.init(src, init_opts, opts);
if (combo.te.data().accesskit_node()) |ak_node| {
AccessKit.nodeSetRole(ak_node, AccessKit.Role.editable_combo_box.asU8());
// Accessibility TODO: Expand and collapse
}
combo.sug = dvui.suggestion(combo.te, .{ .button = true, .open_on_focus = false, .open_on_text_change = false, .label = .{ .text = combo.te.getText() } });
// suggestion forwards events to textEntry, so don't call te.processEvents()
combo.te.draw();
return combo;
}