1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 06:40:06 -04:00

Add new ComboBox builder to replace the combo_box_with_label function

This commit is contained in:
Emil Ernerfeldt
2021-03-27 10:35:40 +01:00
parent 795282edc0
commit 41c9de2734
4 changed files with 155 additions and 33 deletions

View File

@@ -136,11 +136,14 @@ impl WidgetGallery {
ui.end_row();
ui.add(doc_link_label("Combo box", "combo_box"));
egui::combo_box_with_label(ui, "Take your pick", format!("{:?}", radio), |ui| {
ui.selectable_value(radio, Enum::First, "First");
ui.selectable_value(radio, Enum::Second, "Second");
ui.selectable_value(radio, Enum::Third, "Third");
});
egui::ComboBox::from_label("Take your pick")
.selected_text(format!("{:?}", radio))
.show_ui(ui, |ui| {
ui.selectable_value(radio, Enum::First, "First");
ui.selectable_value(radio, Enum::Second, "Second");
ui.selectable_value(radio, Enum::Third, "Third");
});
ui.end_row();
ui.add(doc_link_label("Slider", "Slider"));