Add method to enable generation of a ComboBox with both id and label (#1204)
This commit is contained in:
parent
1b623fdd34
commit
3cd3cceefd
1 changed files with 10 additions and 0 deletions
|
@ -27,6 +27,16 @@ pub struct ComboBox {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl 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
|
/// Label shown next to the combo box
|
||||||
pub fn from_label(label: impl Into<WidgetText>) -> Self {
|
pub fn from_label(label: impl Into<WidgetText>) -> Self {
|
||||||
let label = label.into();
|
let label = label.into();
|
||||||
|
|
Loading…
Reference in a new issue