mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-16 07:35:57 +08:00
MSW specific: Follow up 683cb42454
- Set Selection for the content of focused controls (TextCtrls a SpinCtrls)
This commit is contained in:
parent
acd2448f10
commit
60d8a7b301
@ -1188,11 +1188,21 @@ void Tab::activate_option(const std::string& opt_key, const wxString& category)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto set_focus = [](wxWindow* win) {
|
||||||
|
win->SetFocus();
|
||||||
|
#ifdef WIN32
|
||||||
|
if (wxTextCtrl* text = dynamic_cast<wxTextCtrl*>(win))
|
||||||
|
text->SetSelection(-1, -1);
|
||||||
|
else if (wxSpinCtrl* spin = dynamic_cast<wxSpinCtrl*>(win))
|
||||||
|
spin->SetSelection(-1, -1);
|
||||||
|
#endif // WIN32
|
||||||
|
};
|
||||||
|
|
||||||
Field* field = get_field(opt_key);
|
Field* field = get_field(opt_key);
|
||||||
|
|
||||||
// focused selected field
|
// focused selected field
|
||||||
if (field)
|
if (field)
|
||||||
field->getWindow()->SetFocus();
|
set_focus(field->getWindow());
|
||||||
else if (category == "Single extruder MM setup") {
|
else if (category == "Single extruder MM setup") {
|
||||||
// When we show and hide "Single extruder MM setup" page,
|
// When we show and hide "Single extruder MM setup" page,
|
||||||
// related options are still in the search list
|
// related options are still in the search list
|
||||||
@ -1200,7 +1210,7 @@ void Tab::activate_option(const std::string& opt_key, const wxString& category)
|
|||||||
// as a "way" to show hidden page again
|
// as a "way" to show hidden page again
|
||||||
field = get_field("single_extruder_multi_material");
|
field = get_field("single_extruder_multi_material");
|
||||||
if (field)
|
if (field)
|
||||||
field->getWindow()->SetFocus();
|
set_focus(field->getWindow());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_highlighter.init(get_custom_ctrl_with_blinking_ptr(opt_key));
|
m_highlighter.init(get_custom_ctrl_with_blinking_ptr(opt_key));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user