mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 08:47:52 -06:00
Fix for #5231. Suppress scrolling for the PresetComboBoxes when they aren't dropped.
This commit is contained in:
parent
1ce8cddbda
commit
250bd689f2
2 changed files with 17 additions and 0 deletions
|
@ -103,6 +103,8 @@ PresetComboBox::PresetComboBox(wxWindow* parent, Preset::Type preset_type, const
|
|||
|
||||
// parameters for an icon's drawing
|
||||
fill_width_height();
|
||||
Bind(wxEVT_COMBOBOX_DROPDOWN, [this](wxCommandEvent& evt) { m_suppress_change = false; });
|
||||
Bind(wxEVT_COMBOBOX_CLOSEUP, [this](wxCommandEvent& evt) { m_suppress_change = true ; });
|
||||
|
||||
Bind(wxEVT_COMBOBOX, [this](wxCommandEvent& evt) {
|
||||
// see https://github.com/prusa3d/PrusaSlicer/issues/3889
|
||||
|
@ -147,6 +149,15 @@ bool PresetComboBox::set_printer_technology(PrinterTechnology pt)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool PresetComboBox::check_event_for_suppress_change(wxCommandEvent& evt)
|
||||
{
|
||||
if (m_suppress_change) {
|
||||
evt.StopPropagation();
|
||||
SetSelection(m_last_selected);
|
||||
}
|
||||
return m_suppress_change;
|
||||
}
|
||||
|
||||
void PresetComboBox::invalidate_selection()
|
||||
{
|
||||
m_last_selected = INT_MAX; // this value means that no one item is selected
|
||||
|
@ -534,6 +545,8 @@ PlaterPresetComboBox::PlaterPresetComboBox(wxWindow *parent, Preset::Type preset
|
|||
PresetComboBox(parent, preset_type, wxSize(15 * wxGetApp().em_unit(), -1))
|
||||
{
|
||||
Bind(wxEVT_COMBOBOX, [this](wxCommandEvent &evt) {
|
||||
if (check_event_for_suppress_change(evt))
|
||||
return;
|
||||
auto selected_item = evt.GetSelection();
|
||||
|
||||
auto marker = reinterpret_cast<Marker>(this->GetClientData(selected_item));
|
||||
|
@ -871,6 +884,8 @@ TabPresetComboBox::TabPresetComboBox(wxWindow* parent, Preset::Type preset_type)
|
|||
PresetComboBox(parent, preset_type, wxSize(35 * wxGetApp().em_unit(), -1))
|
||||
{
|
||||
Bind(wxEVT_COMBOBOX, [this](wxCommandEvent& evt) {
|
||||
if (check_event_for_suppress_change(evt))
|
||||
return;
|
||||
// see https://github.com/prusa3d/PrusaSlicer/issues/3889
|
||||
// Under OSX: in case of use of a same names written in different case (like "ENDER" and "Ender")
|
||||
// m_presets_choice->GetSelection() will return first item, because search in PopupListCtrl is case-insensitive.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue