Allow showing error without field focusing.

This commit is contained in:
John Preston 2019-09-26 11:10:03 +03:00
parent ba1c7d8d31
commit 84d68e48c0
2 changed files with 6 additions and 1 deletions

View file

@ -3506,12 +3506,16 @@ void InputField::setEditLinkCallback(
} }
void InputField::showError() { void InputField::showError() {
setErrorShown(true); showErrorNoFocus();
if (!hasFocus()) { if (!hasFocus()) {
_inner->setFocus(); _inner->setFocus();
} }
} }
void InputField::showErrorNoFocus() {
setErrorShown(true);
}
void InputField::setErrorShown(bool error) { void InputField::setErrorShown(bool error) {
if (_error != error) { if (_error != error) {
_error = error; _error = error;

View file

@ -187,6 +187,7 @@ public:
const TextWithTags &value = TextWithTags()); const TextWithTags &value = TextWithTags());
void showError(); void showError();
void showErrorNoFocus();
void setMaxLength(int maxLength); void setMaxLength(int maxLength);
void setMinHeight(int minHeight); void setMinHeight(int minHeight);