textbox: delete key support

This commit is contained in:
MihailRis 2024-02-22 13:06:37 +03:00
parent 4abe775c5b
commit c674bd4ec5

View File

@ -365,6 +365,11 @@ void TextBox::keyPressed(int key) {
caret--;
validate();
}
} else if (key == keycode::DELETE) {
if (caret < input.length()) {
input = input.substr(0, caret) + input.substr(caret + 1);
validate();
}
} else if (key == keycode::ENTER) {
if (validate() && consumer) {
consumer(label->getText());