mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:38:12 +00:00
LibGUI: Make ComboBox text editor release focus when Escape is pressed
This commit is contained in:
parent
1349b8b10f
commit
f922ffb032
1 changed files with 12 additions and 0 deletions
|
@ -7,10 +7,12 @@
|
|||
#include <LibGUI/Button.h>
|
||||
#include <LibGUI/ComboBox.h>
|
||||
#include <LibGUI/Desktop.h>
|
||||
#include <LibGUI/Event.h>
|
||||
#include <LibGUI/ListView.h>
|
||||
#include <LibGUI/Model.h>
|
||||
#include <LibGUI/Scrollbar.h>
|
||||
#include <LibGUI/TextBox.h>
|
||||
#include <LibGUI/TextEditor.h>
|
||||
#include <LibGUI/Window.h>
|
||||
|
||||
REGISTER_WIDGET(GUI, ComboBox)
|
||||
|
@ -36,6 +38,16 @@ private:
|
|||
if (on_mousewheel)
|
||||
on_mousewheel(event.wheel_delta());
|
||||
}
|
||||
|
||||
virtual void keydown_event(KeyEvent& event) override
|
||||
{
|
||||
if (event.key() == Key_Escape) {
|
||||
if (is_focused())
|
||||
set_focus(false);
|
||||
event.accept();
|
||||
} else
|
||||
TextEditor::keydown_event(event);
|
||||
}
|
||||
};
|
||||
|
||||
ComboBox::ComboBox()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue