Add method to enable generation of a ComboBox with both id and label (#1204)

This commit is contained in:
Alan Race 2022-02-04 14:11:08 +01:00 committed by GitHub
parent 1b623fdd34
commit 3cd3cceefd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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();