feat(ui): handle escape key events in CSimpleEditBox (#103)

Co-authored-by: fallenoak <git@fallenoak.me>
This commit is contained in:
Tristan 'Natrist' Cormier 2025-10-05 11:46:18 -04:00 committed by GitHub
parent 5055e03f65
commit 66ffd99696
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View File

@ -765,7 +765,8 @@ void CSimpleEditBox::OnEnterPressed() {
}
void CSimpleEditBox::OnEscapePressed() {
// TODO
this->RunOnEscapePressedScript();
// TODO this->DispatchAction(EVENT_ESCAPE);
}
void CSimpleEditBox::OnTabPressed() {
@ -1028,6 +1029,12 @@ void CSimpleEditBox::RunOnEnterPressedScript() {
}
}
void CSimpleEditBox::RunOnEscapePressedScript() {
if (this->m_onEscapePressed.luaRef) {
this->RunScript(this->m_onEscapePressed, 0, nullptr);
}
}
void CSimpleEditBox::RunOnTabPressedScript() {
if (this->m_onTabPressed.luaRef) {
this->RunScript(this->m_onTabPressed, 0, nullptr);

View File

@ -100,6 +100,7 @@ class CSimpleEditBox : public CSimpleFrame, CSimpleFontedFrame {
void RunOnEditFocusGainedScript();
void RunOnEditFocusLostScript();
void RunOnEnterPressedScript();
void RunOnEscapePressedScript();
void RunOnTabPressedScript();
void RunOnTextChangedScript(int32_t changed);
void SetCursorPosition(int32_t position);