From 213d0c355337962b19ac70f8fa9fc8d97a8a852c Mon Sep 17 00:00:00 2001 From: nordsoft Date: Sun, 1 Oct 2023 16:40:26 +0200 Subject: [PATCH] Capture events in chat box --- client/lobby/CSelectionBase.cpp | 5 +++++ client/lobby/CSelectionBase.h | 1 + 2 files changed, 6 insertions(+) diff --git a/client/lobby/CSelectionBase.cpp b/client/lobby/CSelectionBase.cpp index 4982d8f76..a9444deea 100644 --- a/client/lobby/CSelectionBase.cpp +++ b/client/lobby/CSelectionBase.cpp @@ -327,6 +327,11 @@ CChatBox::CChatBox(const Rect & rect) chatHistory->label->color = Colors::GREEN; } +bool CChatBox::captureThisKey(EShortcut key) +{ + return !inputBox->getText().empty() && key == EShortcut::GLOBAL_ACCEPT; +} + void CChatBox::keyPressed(EShortcut key) { if(key == EShortcut::GLOBAL_ACCEPT && inputBox->getText().size()) diff --git a/client/lobby/CSelectionBase.h b/client/lobby/CSelectionBase.h index 5436a959e..7b714fb64 100644 --- a/client/lobby/CSelectionBase.h +++ b/client/lobby/CSelectionBase.h @@ -122,6 +122,7 @@ public: CChatBox(const Rect & rect); void keyPressed(EShortcut key) override; + bool captureThisKey(EShortcut key) override; void addNewMessage(const std::string & text); };