mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-23 06:33:57 -06:00
Fix for #6941 - Search Settings: Put focus into input field when navigating to the setting
This commit is contained in:
parent
d7216b5d68
commit
683cb42454
3 changed files with 15 additions and 4 deletions
|
@ -1920,6 +1920,8 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
||||||
sidebar->Bind(wxEVT_COMBOBOX, &priv::on_select_preset, this);
|
sidebar->Bind(wxEVT_COMBOBOX, &priv::on_select_preset, this);
|
||||||
sidebar->Bind(EVT_OBJ_LIST_OBJECT_SELECT, [this](wxEvent&) { priv::selection_changed(); });
|
sidebar->Bind(EVT_OBJ_LIST_OBJECT_SELECT, [this](wxEvent&) { priv::selection_changed(); });
|
||||||
sidebar->Bind(EVT_SCHEDULE_BACKGROUND_PROCESS, [this](SimpleEvent&) { this->schedule_background_process(); });
|
sidebar->Bind(EVT_SCHEDULE_BACKGROUND_PROCESS, [this](SimpleEvent&) { this->schedule_background_process(); });
|
||||||
|
// jump to found option from SearchDialog
|
||||||
|
q->Bind(wxCUSTOMEVT_JUMP_TO_OPTION, [this](wxCommandEvent& evt) { sidebar->jump_to_option(evt.GetInt()); });
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGLCanvas* view3D_canvas = view3D->get_wxglcanvas();
|
wxGLCanvas* view3D_canvas = view3D->get_wxglcanvas();
|
||||||
|
|
|
@ -24,6 +24,8 @@ using boost::optional;
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
|
wxDEFINE_EVENT(wxCUSTOMEVT_JUMP_TO_OPTION, wxCommandEvent);
|
||||||
|
|
||||||
using GUI::from_u8;
|
using GUI::from_u8;
|
||||||
using GUI::into_u8;
|
using GUI::into_u8;
|
||||||
|
|
||||||
|
@ -293,8 +295,6 @@ OptionsSearcher::OptionsSearcher()
|
||||||
|
|
||||||
OptionsSearcher::~OptionsSearcher()
|
OptionsSearcher::~OptionsSearcher()
|
||||||
{
|
{
|
||||||
if (search_dialog)
|
|
||||||
search_dialog->Destroy();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionsSearcher::init(std::vector<InputInfo> input_values)
|
void OptionsSearcher::init(std::vector<InputInfo> input_values)
|
||||||
|
@ -530,9 +530,16 @@ void SearchDialog::ProcessSelection(wxDataViewItem selection)
|
||||||
{
|
{
|
||||||
if (!selection.IsOk())
|
if (!selection.IsOk())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GUI::wxGetApp().sidebar().jump_to_option(search_list_model->GetRow(selection));
|
|
||||||
this->EndModal(wxID_CLOSE);
|
this->EndModal(wxID_CLOSE);
|
||||||
|
|
||||||
|
// If call GUI::wxGetApp().sidebar.jump_to_option() directly from here,
|
||||||
|
// then mainframe will not have focus and found option will not be "active" (have cursor) as a result
|
||||||
|
// SearchDialog have to be closed and have to lose a focus
|
||||||
|
// and only after that jump_to_option() function can be called
|
||||||
|
// So, post event to plater:
|
||||||
|
wxCommandEvent event(wxCUSTOMEVT_JUMP_TO_OPTION);
|
||||||
|
event.SetInt(search_list_model->GetRow(selection));
|
||||||
|
wxPostEvent(GUI::wxGetApp().plater(), event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchDialog::OnInputText(wxCommandEvent&)
|
void SearchDialog::OnInputText(wxCommandEvent&)
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
|
wxDECLARE_EVENT(wxCUSTOMEVT_JUMP_TO_OPTION, wxCommandEvent);
|
||||||
|
|
||||||
namespace Search{
|
namespace Search{
|
||||||
|
|
||||||
class SearchDialog;
|
class SearchDialog;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue