From 3db4804e476aa4b6cb320f696bc6ddd094c9087a Mon Sep 17 00:00:00 2001 From: YuSanka Date: Fri, 10 Sep 2021 14:07:29 +0200 Subject: [PATCH] MSW specific: ObjectList: Fixed eternal Editor Control Steps to reproduce of a bug: 1. Add object 2. Click the Cog icon with the left mouse button 3. DoubleClick on name of object > An Editor Control appears that cannot be deleted any way --- src/slic3r/GUI/ExtraRenderers.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/slic3r/GUI/ExtraRenderers.cpp b/src/slic3r/GUI/ExtraRenderers.cpp index e9fb7339f3..5fe86db275 100644 --- a/src/slic3r/GUI/ExtraRenderers.cpp +++ b/src/slic3r/GUI/ExtraRenderers.cpp @@ -197,6 +197,17 @@ wxWindow* BitmapTextRenderer::CreateEditorCtrl(wxWindow* parent, wxRect labelRec labelRect.SetWidth(labelRect.GetWidth() - bmp_width); } +#ifdef __WXMSW__ + // Case when from some reason we try to create next EditorCtrl till old one was not deleted + if (auto children = parent->GetChildren(); children.GetCount() > 0) + for (auto child : children) + if (dynamic_cast(child)) { + parent->RemoveChild(child); + child->Destroy(); + break; + } +#endif // __WXMSW__ + wxTextCtrl* text_editor = new wxTextCtrl(parent, wxID_ANY, data.GetText(), position, labelRect.GetSize(), wxTE_PROCESS_ENTER); text_editor->SetInsertionPointEnd();