mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-16 14:25:57 +08:00
Fix search bar losing focus while typing (PR #13691 by @themanyone)
This commit is contained in:
parent
3db367be4a
commit
209d23e0ae
@ -1650,7 +1650,6 @@ void MainFrame::init_menubar_as_editor()
|
||||
editMenu->AppendSeparator();
|
||||
append_menu_item(editMenu, wxID_ANY, _L("Searc&h") + "\tCtrl+F",
|
||||
_L("Search in settings"), [this](wxCommandEvent&) {
|
||||
// wxGetApp().show_search_dialog();
|
||||
m_tabpanel->GetTopBarItemsCtrl()->TriggerSearch();
|
||||
},
|
||||
"search", nullptr, []() {return true; }, this);
|
||||
|
@ -528,13 +528,12 @@ void OptionsSearcher::edit_search_input()
|
||||
void OptionsSearcher::process_key_down_from_input(wxKeyEvent& e)
|
||||
{
|
||||
int key = e.GetKeyCode();
|
||||
if (key == WXK_ESCAPE)
|
||||
if (key == WXK_ESCAPE) {
|
||||
set_focus_to_parent();
|
||||
search_dialog->Hide();
|
||||
}
|
||||
else if (search_dialog && (key == WXK_UP || key == WXK_DOWN || key == WXK_NUMPAD_ENTER || key == WXK_RETURN)) {
|
||||
search_dialog->KeyDown(e);
|
||||
#ifdef __linux__
|
||||
search_dialog->SetFocus();
|
||||
#endif // __linux__
|
||||
}
|
||||
}
|
||||
|
||||
@ -708,7 +707,7 @@ void SearchDialog::OnKeyDown(wxKeyEvent& event)
|
||||
if (key == WXK_UP || key == WXK_DOWN)
|
||||
{
|
||||
// So, for the next correct navigation, set focus on the search_list
|
||||
// search_list->SetFocus(); // #ys_delete_after_test -> Looks like no need anymore
|
||||
search_list->SetFocus();
|
||||
|
||||
auto item = search_list->GetSelection();
|
||||
|
||||
|
@ -266,8 +266,8 @@ void TopBarItemsCtrl::CreateSearch()
|
||||
|
||||
m_search->Bind(wxEVT_KILL_FOCUS, [](wxFocusEvent& e)
|
||||
{
|
||||
e.Skip();
|
||||
wxGetApp().searcher().check_and_hide_dialog();
|
||||
e.Skip();
|
||||
});
|
||||
|
||||
wxTextCtrl* ctrl = m_search->GetTextCtrl();
|
||||
@ -303,6 +303,8 @@ void TopBarItemsCtrl::TriggerSearch()
|
||||
{
|
||||
wxGetApp().searcher().set_search_input(m_search);
|
||||
wxGetApp().show_search_dialog();
|
||||
wxTextCtrl* ctrl = m_search->GetTextCtrl();
|
||||
ctrl->SetFocus(); // set focus back to search bar for typing
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user