mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 08:47:52 -06:00
Update value inside TextCtrl & SpinCtrl after wxEVT_KILL_FOCES instead of wxEVT_TEXT (or wxEVT_TEXT_ENTER)
This commit is contained in:
parent
c4e334f863
commit
d7bc1410ee
8 changed files with 68 additions and 47 deletions
|
@ -44,7 +44,7 @@ const t_field& OptionsGroup::build_field(const t_config_option_key& id, const Co
|
|||
case coPercents:
|
||||
case coString:
|
||||
case coStrings:
|
||||
m_fields.emplace(id, std::move(TextCtrl::Create<TextCtrl>(parent(), opt, id, process_enter)));
|
||||
m_fields.emplace(id, std::move(TextCtrl::Create<TextCtrl>(parent(), opt, id)));
|
||||
break;
|
||||
case coBool:
|
||||
case coBools:
|
||||
|
@ -67,16 +67,16 @@ const t_field& OptionsGroup::build_field(const t_config_option_key& id, const Co
|
|||
}
|
||||
// Grab a reference to fields for convenience
|
||||
const t_field& field = m_fields[id];
|
||||
field->m_on_change = [this](std::string opt_id, boost::any value) {
|
||||
field->m_on_change = [this](const std::string& opt_id, const boost::any& value) {
|
||||
//! This function will be called from Field.
|
||||
//! Call OptionGroup._on_change(...)
|
||||
if (!m_disabled)
|
||||
this->on_change_OG(opt_id, value);
|
||||
};
|
||||
field->m_on_kill_focus = [this]() {
|
||||
field->m_on_kill_focus = [this](const std::string& opt_id) {
|
||||
//! This function will be called from Field.
|
||||
if (!m_disabled)
|
||||
this->on_kill_focus();
|
||||
this->on_kill_focus(opt_id);
|
||||
};
|
||||
field->m_parent = parent();
|
||||
|
||||
|
@ -378,6 +378,15 @@ void ConfigOptionsGroup::back_to_config_value(const DynamicPrintConfig& config,
|
|||
on_change_OG(opt_key, get_value(opt_key));
|
||||
}
|
||||
|
||||
void ConfigOptionsGroup::on_kill_focus(const std::string& opt_key)
|
||||
{
|
||||
if (m_fill_empty_value) {
|
||||
m_fill_empty_value(opt_key);
|
||||
return;
|
||||
}
|
||||
reload_config();
|
||||
}
|
||||
|
||||
void ConfigOptionsGroup::reload_config() {
|
||||
for (t_opt_map::iterator it = m_opt_map.begin(); it != m_opt_map.end(); ++it) {
|
||||
auto opt_id = it->first;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue