diff --git a/src/slic3r/GUI/ExtraRenderers.hpp b/src/slic3r/GUI/ExtraRenderers.hpp index ef16ddece9..b778df4c49 100644 --- a/src/slic3r/GUI/ExtraRenderers.hpp +++ b/src/slic3r/GUI/ExtraRenderers.hpp @@ -54,7 +54,7 @@ private: DECLARE_VARIANT_OBJECT(DataViewBitmapText) // ---------------------------------------------------------------------------- -// BitmapTextRenderer +// BitmapTextRenderer - an editable text box within a DataView item // ---------------------------------------------------------------------------- #if ENABLE_NONCUSTOM_DATA_VIEW_RENDERING class BitmapTextRenderer : public wxDataViewRenderer @@ -126,7 +126,7 @@ private: // ---------------------------------------------------------------------------- -// BitmapChoiceRenderer +// BitmapChoiceRenderer - Creates an editable ComboBox within a DataView item // ---------------------------------------------------------------------------- class BitmapChoiceRenderer : public wxDataViewCustomRenderer diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 24f44a12a1..90f1a04060 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -5485,6 +5485,10 @@ void ObjectList::ItemValueChanged(wxDataViewEvent &event) // Here the last active column is forgotten, so when leaving the editing mode, the next mouse click will not enter the editing mode of the newly selected column. void ObjectList::OnEditingStarted(wxDataViewEvent &event) { + if (event.GetColumn() == colFilament) { + ::ComboBox*c = static_cast<::ComboBox *>(event.GetDataViewColumn()->GetRenderer()->GetEditorCtrl()); + c->ToggleDropDown(); + } #ifdef __WXMSW__ m_last_selected_column = -1; #else diff --git a/src/slic3r/GUI/Widgets/ComboBox.cpp b/src/slic3r/GUI/Widgets/ComboBox.cpp index a2aa6a2cb6..a3b3894585 100644 --- a/src/slic3r/GUI/Widgets/ComboBox.cpp +++ b/src/slic3r/GUI/Widgets/ComboBox.cpp @@ -230,9 +230,7 @@ void ComboBox::DoSetItemClientData(unsigned int n, void *data) datas[n] = data; } -void ComboBox::mouseDown(wxMouseEvent &event) -{ - SetFocus(); +void ComboBox::ToggleDropDown(){ if (drop_down) { drop.Hide(); } else if (drop.HasDismissLongTime()) { @@ -244,6 +242,12 @@ void ComboBox::mouseDown(wxMouseEvent &event) } } +void ComboBox::mouseDown(wxMouseEvent &event) +{ + SetFocus(); + ToggleDropDown(); +} + void ComboBox::mouseWheelMoved(wxMouseEvent &event) { event.Skip(); @@ -261,15 +265,7 @@ void ComboBox::keyDown(wxKeyEvent& event) switch (event.GetKeyCode()) { case WXK_RETURN: case WXK_SPACE: - if (drop_down) { - drop.DismissAndNotify(); - } else if (drop.HasDismissLongTime()) { - drop.autoPosition(); - drop_down = true; - drop.Popup(); - wxCommandEvent e(wxEVT_COMBOBOX_DROPDOWN); - GetEventHandler()->ProcessEvent(e); - } + ToggleDropDown(); break; case WXK_UP: case WXK_DOWN: diff --git a/src/slic3r/GUI/Widgets/ComboBox.hpp b/src/slic3r/GUI/Widgets/ComboBox.hpp index b2aca74b08..0e58533cb8 100644 --- a/src/slic3r/GUI/Widgets/ComboBox.hpp +++ b/src/slic3r/GUI/Widgets/ComboBox.hpp @@ -32,7 +32,6 @@ public: virtual bool SetFont(wxFont const & font) override; -public: int Append(const wxString &item, const wxBitmapBundle &bitmap = wxNullBitmap); int Append(const wxString &item, const wxBitmapBundle &bitmap, void *clientData); @@ -62,6 +61,8 @@ public: wxBitmap GetItemBitmap(unsigned int n); void SetItemBitmap(unsigned int n, wxBitmapBundle const &bitmap); + void ToggleDropDown(); + protected: virtual int DoInsertItems(const wxArrayStringsAdapter &items, unsigned int pos,