mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-17 03:25:58 +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();
|
editMenu->AppendSeparator();
|
||||||
append_menu_item(editMenu, wxID_ANY, _L("Searc&h") + "\tCtrl+F",
|
append_menu_item(editMenu, wxID_ANY, _L("Searc&h") + "\tCtrl+F",
|
||||||
_L("Search in settings"), [this](wxCommandEvent&) {
|
_L("Search in settings"), [this](wxCommandEvent&) {
|
||||||
// wxGetApp().show_search_dialog();
|
|
||||||
m_tabpanel->GetTopBarItemsCtrl()->TriggerSearch();
|
m_tabpanel->GetTopBarItemsCtrl()->TriggerSearch();
|
||||||
},
|
},
|
||||||
"search", nullptr, []() {return true; }, this);
|
"search", nullptr, []() {return true; }, this);
|
||||||
|
@ -528,13 +528,12 @@ void OptionsSearcher::edit_search_input()
|
|||||||
void OptionsSearcher::process_key_down_from_input(wxKeyEvent& e)
|
void OptionsSearcher::process_key_down_from_input(wxKeyEvent& e)
|
||||||
{
|
{
|
||||||
int key = e.GetKeyCode();
|
int key = e.GetKeyCode();
|
||||||
if (key == WXK_ESCAPE)
|
if (key == WXK_ESCAPE) {
|
||||||
|
set_focus_to_parent();
|
||||||
search_dialog->Hide();
|
search_dialog->Hide();
|
||||||
|
}
|
||||||
else if (search_dialog && (key == WXK_UP || key == WXK_DOWN || key == WXK_NUMPAD_ENTER || key == WXK_RETURN)) {
|
else if (search_dialog && (key == WXK_UP || key == WXK_DOWN || key == WXK_NUMPAD_ENTER || key == WXK_RETURN)) {
|
||||||
search_dialog->KeyDown(e);
|
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)
|
if (key == WXK_UP || key == WXK_DOWN)
|
||||||
{
|
{
|
||||||
// So, for the next correct navigation, set focus on the search_list
|
// 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();
|
auto item = search_list->GetSelection();
|
||||||
|
|
||||||
|
@ -266,8 +266,8 @@ void TopBarItemsCtrl::CreateSearch()
|
|||||||
|
|
||||||
m_search->Bind(wxEVT_KILL_FOCUS, [](wxFocusEvent& e)
|
m_search->Bind(wxEVT_KILL_FOCUS, [](wxFocusEvent& e)
|
||||||
{
|
{
|
||||||
e.Skip();
|
|
||||||
wxGetApp().searcher().check_and_hide_dialog();
|
wxGetApp().searcher().check_and_hide_dialog();
|
||||||
|
e.Skip();
|
||||||
});
|
});
|
||||||
|
|
||||||
wxTextCtrl* ctrl = m_search->GetTextCtrl();
|
wxTextCtrl* ctrl = m_search->GetTextCtrl();
|
||||||
@ -303,6 +303,8 @@ void TopBarItemsCtrl::TriggerSearch()
|
|||||||
{
|
{
|
||||||
wxGetApp().searcher().set_search_input(m_search);
|
wxGetApp().searcher().set_search_input(m_search);
|
||||||
wxGetApp().show_search_dialog();
|
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