diff --git a/src/ui/CSimpleEditBox.cpp b/src/ui/CSimpleEditBox.cpp index 2716084..b9dbc75 100644 --- a/src/ui/CSimpleEditBox.cpp +++ b/src/ui/CSimpleEditBox.cpp @@ -765,7 +765,8 @@ void CSimpleEditBox::OnEnterPressed() { } void CSimpleEditBox::OnEscapePressed() { - // TODO + this->RunOnEscapePressedScript(); + // TODO this->DispatchAction(EVENT_ESCAPE); } void CSimpleEditBox::OnFrameSizeChanged(float width, float height) { @@ -1019,6 +1020,12 @@ void CSimpleEditBox::RunOnEnterPressedScript() { } } +void CSimpleEditBox::RunOnEscapePressedScript() { + if (this->m_onEscapePressed.luaRef) { + this->RunScript(this->m_onEscapePressed, 0, nullptr); + } +} + void CSimpleEditBox::RunOnTextChangedScript(int32_t changed) { if (this->m_onTextChanged.luaRef) { auto L = FrameScript_GetContext(); diff --git a/src/ui/CSimpleEditBox.hpp b/src/ui/CSimpleEditBox.hpp index 1272e8f..80fc460 100644 --- a/src/ui/CSimpleEditBox.hpp +++ b/src/ui/CSimpleEditBox.hpp @@ -99,6 +99,7 @@ class CSimpleEditBox : public CSimpleFrame, CSimpleFontedFrame { void RunOnEditFocusGainedScript(); void RunOnEditFocusLostScript(); void RunOnEnterPressedScript(); + void RunOnEscapePressedScript(); void RunOnTextChangedScript(int32_t changed); void SetCursorPosition(int32_t position); void SetHistoryLines(int32_t a2);