Support Up/DownArrow keys to change NumericEditBox value

pull/303/head
scrawl 7 years ago
parent 67dc4e019a
commit 76ddf8d794

@ -75,4 +75,20 @@ namespace Gui
setCaption(MyGUI::utility::toString(mValue));
}
void NumericEditBox::onKeyButtonPressed(MyGUI::KeyCode key, MyGUI::Char character)
{
if (key == MyGUI::KeyCode::ArrowUp)
{
setValue(std::min(mValue+1, mMaxValue));
eventValueChanged(mValue);
}
else if (key == MyGUI::KeyCode::ArrowDown)
{
setValue(std::max(mValue-1, mMinValue));
eventValueChanged(mValue);
}
else
Base::onKeyButtonPressed(key, character);
}
}

@ -33,6 +33,7 @@ namespace Gui
private:
void onEditTextChange(MyGUI::EditBox* sender);
void onKeyLostFocus(MyGUI::Widget* _new);
void onKeyButtonPressed(MyGUI::KeyCode key, MyGUI::Char character);
int mValue;

Loading…
Cancel
Save