mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:57:43 +00:00
CharacterMap: Make the search happen as you type
This commit is contained in:
parent
1f0f96e6d7
commit
a1baa5cb00
3 changed files with 5 additions and 19 deletions
|
@ -8,6 +8,7 @@
|
|||
#include "CharacterSearchWidget.h"
|
||||
#include "SearchCharacters.h"
|
||||
#include <Applications/CharacterMap/CharacterSearchWindowGML.h>
|
||||
#include <LibCore/Debounce.h>
|
||||
|
||||
struct SearchResult {
|
||||
u32 code_point;
|
||||
|
@ -56,14 +57,12 @@ CharacterSearchWidget::CharacterSearchWidget()
|
|||
load_from_gml(character_search_window_gml).release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
m_search_input = find_descendant_of_type_named<GUI::TextBox>("search_input");
|
||||
m_search_button = find_descendant_of_type_named<GUI::Button>("search_button");
|
||||
m_results_table = find_descendant_of_type_named<GUI::TableView>("results_table");
|
||||
|
||||
m_search_input->on_up_pressed = [this] { m_results_table->move_cursor(GUI::AbstractView::CursorMovement::Up, GUI::AbstractView::SelectionUpdate::Set); };
|
||||
m_search_input->on_down_pressed = [this] { m_results_table->move_cursor(GUI::AbstractView::CursorMovement::Down, GUI::AbstractView::SelectionUpdate::Set); };
|
||||
|
||||
m_search_input->on_return_pressed = [this] { search(); };
|
||||
m_search_button->on_click = [this](auto) { search(); };
|
||||
m_search_input->on_change = Core::debounce([this] { search(); }, 100);
|
||||
|
||||
m_results_table->horizontal_scrollbar().set_visible(false);
|
||||
m_results_table->set_column_headers_visible(false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue