Struct egui::containers::ComboBox [−][src]
pub struct ComboBox { /* fields omitted */ }
A drop-down selection menu with a descriptive label.
egui::ComboBox::from_label( "Select one!") .selected_text(format!("{:?}", selected)) .show_ui(ui, |ui| { ui.selectable_value(&mut selected, Enum::First, "First"); ui.selectable_value(&mut selected, Enum::Second, "Second"); ui.selectable_value(&mut selected, Enum::Third, "Third"); } );
Implementations
impl ComboBox
[src]
impl ComboBox
[src]pub fn from_label(label: impl Into<Label>) -> Self
[src]
pub fn from_label(label: impl Into<Label>) -> Self
[src]Label shown next to the combo box
pub fn from_id_source(id_source: impl Hash) -> Self
[src]
pub fn from_id_source(id_source: impl Hash) -> Self
[src]Without label.
pub fn selected_text(self, selected_text: impl ToString) -> Self
[src]
pub fn selected_text(self, selected_text: impl ToString) -> Self
[src]What we show as the currently selected value
pub fn show_ui(
self,
ui: &mut Ui,
menu_contents: impl FnOnce(&mut Ui)
) -> Response
[src]
pub fn show_ui(
self,
ui: &mut Ui,
menu_contents: impl FnOnce(&mut Ui)
) -> Response
[src]Show the combo box, with the given ui code for the menu contents.
pub fn show_index(
self,
ui: &mut Ui,
selected: &mut usize,
len: usize,
get: impl Fn(usize) -> String
) -> Response
[src]
pub fn show_index(
self,
ui: &mut Ui,
selected: &mut usize,
len: usize,
get: impl Fn(usize) -> String
) -> Response
[src]Show a list of items with the given selected index.
let alternatives = ["a", "b", "c", "d"]; let mut selected = 2; egui::ComboBox::from_label( "Select one!").show_index( ui, &mut selected, alternatives.len(), |i| alternatives[i].to_owned() );