mirror of
https://github.com/emilk/egui.git
synced 2026-06-26 22:53:14 -04:00
Add method to enable generation of a ComboBox with both id and label (#1204)
This commit is contained in:
@@ -27,6 +27,16 @@ pub struct ComboBox {
|
||||
}
|
||||
|
||||
impl ComboBox {
|
||||
/// Create new `ComboBox` with id and label
|
||||
pub fn new(id_source: impl std::hash::Hash, label: impl Into<WidgetText>) -> Self {
|
||||
Self {
|
||||
id_source: Id::new(id_source),
|
||||
label: Some(label.into()),
|
||||
selected_text: Default::default(),
|
||||
width: None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Label shown next to the combo box
|
||||
pub fn from_label(label: impl Into<WidgetText>) -> Self {
|
||||
let label = label.into();
|
||||
|
||||
Reference in New Issue
Block a user