diff --git a/src/ui/entry.cpp b/src/ui/entry.cpp index 0b1fe70de..18e3a2d87 100644 --- a/src/ui/entry.cpp +++ b/src/ui/entry.cpp @@ -144,6 +144,11 @@ void Entry::selectText(int from, int to) invalidate(); } +void Entry::selectAllText() +{ + selectText(0, -1); +} + void Entry::deselectText() { m_select = -1; diff --git a/src/ui/entry.h b/src/ui/entry.h index 3c19d8c4f..0064eeb20 100644 --- a/src/ui/entry.h +++ b/src/ui/entry.h @@ -32,6 +32,7 @@ namespace ui { void setCaretPos(int pos); void selectText(int from, int to); + void selectAllText(); void deselectText(); void setSuffix(const std::string& suffix); diff --git a/src/ui/int_entry.cpp b/src/ui/int_entry.cpp index 6cdd512fa..d45c1c535 100644 --- a/src/ui/int_entry.cpp +++ b/src/ui/int_entry.cpp @@ -80,8 +80,10 @@ bool IntEntry::onProcessMessage(Message* msg) int oldValue = getValue(); int newValue = oldValue + jmouse_z(0) - jmouse_z(1); newValue = MID(m_min, newValue, m_max); - if (newValue != oldValue) + if (newValue != oldValue) { setValue(newValue); + selectAllText(); + } return true; } break; @@ -139,6 +141,7 @@ void IntEntry::closePopup() void IntEntry::onChangeSlider() { setValue(m_slider->getValue()); + selectAllText(); } } // namespace ui