mirror of https://github.com/OpenTTD/OpenTTD
(svn r25647) -Add: If an editbox is configured to be cleared with ESC, but the editbox is already empty, unselect the editbox instead.
parent
c47ef21af0
commit
a3efc99034
|
@ -2429,9 +2429,14 @@ EventState Window::HandleEditBoxKey(int wid, uint16 key, uint16 keycode)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QueryString::ACTION_CLEAR:
|
case QueryString::ACTION_CLEAR:
|
||||||
|
if (query->text.bytes <= 1) {
|
||||||
|
/* If already empty, unfocus instead */
|
||||||
|
this->UnfocusFocusedWidget();
|
||||||
|
} else {
|
||||||
query->text.DeleteAll();
|
query->text.DeleteAll();
|
||||||
this->SetWidgetDirty(wid);
|
this->SetWidgetDirty(wid);
|
||||||
this->OnEditboxChanged(wid);
|
this->OnEditboxChanged(wid);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue