Add max length to name
This commit is contained in:
parent
2cc78905c3
commit
45a3cbb163
@ -53,6 +53,7 @@ text = "Name:"
|
||||
[node name="text_edit" type="LineEdit" parent="v_box_container/h_box_container" unique_id=284528736]
|
||||
custom_minimum_size = Vector2(150, 0)
|
||||
layout_mode = 2
|
||||
max_length = 20
|
||||
|
||||
[node name="players_label" type="Label" parent="v_box_container" unique_id=1537542117]
|
||||
layout_mode = 2
|
||||
|
||||
@ -103,19 +103,20 @@ impl IPanel for SettingsPanel {
|
||||
slider.upcast::<Control>()
|
||||
}
|
||||
SettingValue::String(value) => {
|
||||
let mut text_edit = LineEdit::new_alloc();
|
||||
text_edit.set_custom_minimum_size(Vector2::new(100., -1.));
|
||||
text_edit.set_text(value);
|
||||
let mut line_edit = LineEdit::new_alloc();
|
||||
line_edit.set_custom_minimum_size(Vector2::new(100., -1.));
|
||||
line_edit.set_text(value);
|
||||
line_edit.set_max_length(20);
|
||||
|
||||
let setting_clone = setting.clone();
|
||||
text_edit
|
||||
line_edit
|
||||
.signals()
|
||||
.text_changed()
|
||||
.connect_other(self, move |s, v| {
|
||||
s.on_change(setting_clone, SettingValue::String(v.to_string()));
|
||||
});
|
||||
|
||||
text_edit.upcast()
|
||||
line_edit.upcast()
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user