From 80b6507071ffd65f4ed397b7994482229fb303e0 Mon Sep 17 00:00:00 2001 From: volzhs Date: Sat, 5 Nov 2016 02:34:19 +0900 Subject: [PATCH] Fix updating value of SpinBox with prefix --- scene/gui/spin_box.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp index 98e1a32aef..9417c25424 100644 --- a/scene/gui/spin_box.cpp +++ b/scene/gui/spin_box.cpp @@ -51,7 +51,10 @@ void SpinBox::_text_entered(const String& p_string) { //if (!p_string.is_numeric()) // return; - set_val( p_string.to_double() ); + String value = p_string; + if (prefix!="" && p_string.begins_with(prefix)) + value = p_string.substr(prefix.length(), p_string.length()-prefix.length()); + set_val( value.to_double() ); _value_changed(0); }