IntEntry: select all text when the value is changed with the slider

This commit is contained in:
David Capello 2014-02-08 18:58:28 -03:00
parent 721734d26c
commit 7eb41c73e9
3 changed files with 10 additions and 1 deletions

View File

@ -144,6 +144,11 @@ void Entry::selectText(int from, int to)
invalidate();
}
void Entry::selectAllText()
{
selectText(0, -1);
}
void Entry::deselectText()
{
m_select = -1;

View File

@ -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);

View File

@ -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