summaryrefslogtreecommitdiff
path: root/Libraries
diff options
context:
space:
mode:
authorpkotzbach <pawelkotzbach@gmail.com>2020-09-15 19:37:36 +0200
committerAndreas Kling <kling@serenityos.org>2020-09-15 20:37:13 +0200
commit82696078b027c78f480698cfa4f73a2de5052222 (patch)
tree8743f71a648ce589de2e3a9f7c7fd3101af28ce6 /Libraries
parent3a8109d1e022123a66f45745c78002a9f08c3366 (diff)
downloadserenity-82696078b027c78f480698cfa4f73a2de5052222.zip
LibGUI: Fix to ComboBox fields activation
Diffstat (limited to 'Libraries')
-rw-r--r--Libraries/LibGUI/ComboBox.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/Libraries/LibGUI/ComboBox.cpp b/Libraries/LibGUI/ComboBox.cpp
index a4e722b789..089fb560b1 100644
--- a/Libraries/LibGUI/ComboBox.cpp
+++ b/Libraries/LibGUI/ComboBox.cpp
@@ -60,10 +60,6 @@ ComboBox::ComboBox()
{
m_editor = add<ComboBoxEditor>();
m_editor->set_has_open_button(true);
- m_editor->on_change = [this] {
- if (on_change)
- on_change(m_editor->text(), m_list_view->cursor_index());
- };
m_editor->on_return_pressed = [this] {
if (on_return_pressed)
on_return_pressed();
@@ -121,15 +117,17 @@ ComboBox::ComboBox()
m_editor->set_text(new_value);
if (!m_only_allow_values_from_model)
m_editor->select_all();
+ };
+
+ m_list_view->on_activation = [this](auto& index) {
deferred_invoke([this, index](auto&) {
if (on_change)
on_change(m_editor->text(), index);
});
- };
- m_list_view->on_activation = [this](auto&) {
m_list_view->set_activates_on_selection(false);
close();
};
+
m_list_view->on_escape_pressed = [this] {
close();
};