1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Merge pull request #2996 from Nordsoft91/fix-2992

Capture key event in chat box
This commit is contained in:
Ivan Savenko 2023-10-04 19:59:06 +03:00 committed by GitHub
commit 56d5c74a61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -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())

View File

@ -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);
};