From 838382791eb8a8d88d091662de39d34fde314fe9 Mon Sep 17 00:00:00 2001 From: Joel Madigan Date: Fri, 29 Nov 2013 17:22:57 -0500 Subject: [PATCH] Tweaked IntEntry behavior Changed behavior of IntEntry to stop it from continously selecting all text as long as the mouse is over the input box. It appears that something continues to send kMouseEnterMessage messages while use is typing, even if the mouse is still. This caused the IntEntry select-all multiple times and as the user typed would replace what they had already written. Also force value to be set within min >= value >= max when focus is lost. This will get rid of bad values from the entry, such as 10q goes to 10, 40000 goes to 255, etc. --- src/ui/int_entry.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ui/int_entry.cpp b/src/ui/int_entry.cpp index 2bac6dfed..6cdd512fa 100644 --- a/src/ui/int_entry.cpp +++ b/src/ui/int_entry.cpp @@ -64,7 +64,11 @@ bool IntEntry::onProcessMessage(Message* msg) // text is automatically selected. case kMouseEnterMessage: requestFocus(); - selectText(0, -1); + break; + + // Reset value if it's out of bounds when focus is lost + case kFocusLeaveMessage: + setValue(MID(m_min, getValue(), m_max)); break; case kMouseDownMessage: