input: remove focus on enter key. don't catch stoll/stodd exception.
This commit is contained in:
parent
03c6f51e16
commit
31370234df
|
@ -82,7 +82,7 @@ namespace bwidgets::abstract
|
|||
case SDLK_RETURN2: // what is return2 btw?
|
||||
case SDLK_KP_ENTER:
|
||||
value = value_from_string(input_text());
|
||||
input_text(value_to_string(value));
|
||||
focus(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -186,17 +186,10 @@ namespace bwidgets::abstract
|
|||
if constexpr(std::is_arithmetic_v<T>)
|
||||
{
|
||||
s = s.length() > 0 ? s : "0";
|
||||
try
|
||||
{
|
||||
if constexpr(std::is_floating_point_v<T>)
|
||||
v = (T)std::stold(s);
|
||||
else if constexpr(std::is_integral_v<T>)
|
||||
v = (T)std::stoll(s);
|
||||
}
|
||||
catch(std::exception&)
|
||||
{
|
||||
v = value;
|
||||
}
|
||||
if constexpr(std::is_floating_point_v<T>)
|
||||
v = (T)std::stold(s);
|
||||
else if constexpr(std::is_integral_v<T>)
|
||||
v = (T)std::stoll(s);
|
||||
}
|
||||
else if constexpr(std::is_same_v<T, std::string> || std::convertible_to<std::string, T>)
|
||||
v = s;
|
||||
|
|
Loading…
Reference in a new issue