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

Co-authored-by: fallenoak <git@fallenoak.me>
This commit is contained in:
Tristan 'Natrist' Cormierandfallenoak authored and GitHub committed 2025-10-05 10:46:18 -05:00
1 parent 5055e03f65
commit 66ffd99696
2 files changed
+9 -1

No files matched your search

+8 -1
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);
+1
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);