Skip to content

ComboBox.show_ui().response.changed() not firing #923

Answered by vbeffa
vbeffa asked this question in Q&A
Discussion options

You must be logged in to vote

It looks like you need to add if xxx.clicked() to each value inside the combobox:

egui::ComboBox::from_label( "Select one!")
    .selected_text(format!("{:?}", selected))
    .show_ui(ui, |ui| {
        if ui.selectable_value(&mut selected, Enum::First, "First").clicked() {
          // handle click
        };
        if ui.selectable_value(&mut selected, Enum::Second, "Second").clicked() {
          // handle click
        };
        if ui.selectable_value(&mut selected, Enum::Third, "Third").clicked() {
          // handle click
        };
    }
);

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@emilk
Comment options

Answer selected by vbeffa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants