diff --git a/libs/wxutil/TreeView.cpp b/libs/wxutil/TreeView.cpp index 39700be4a2..c3b324653b 100644 --- a/libs/wxutil/TreeView.cpp +++ b/libs/wxutil/TreeView.cpp @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -208,12 +209,14 @@ class TreeView::SearchPopupWindow : public: SearchPopupWindow(TreeView* treeView, Search& owner) : - wxPopupWindow(treeView), + wxPopupWindow(treeView, wxBORDER_SIMPLE), _owner(owner), _entry(nullptr) { SetSizer(new wxBoxSizer(wxHORIZONTAL)); + auto label = new wxStaticText(this, wxID_ANY, _("Find: ")); + _entry = new wxTextCtrl(this, wxID_ANY); auto nextImg = wxArtProvider::GetBitmap(GlobalUIManager().ArtIdPrefix() + "arrow_down.png"); @@ -231,6 +234,7 @@ class TreeView::SearchPopupWindow : nextButton->Bind(wxEVT_BUTTON, [this] (wxCommandEvent& ev) { _owner.HighlightNextMatch(); }); prevButton->Bind(wxEVT_BUTTON, [this] (wxCommandEvent& ev) { _owner.HighlightPrevMatch(); }); + GetSizer()->Add(label, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 6); GetSizer()->Add(_entry, 1, wxEXPAND | wxALL, 6); GetSizer()->Add(prevButton, 0, wxEXPAND | wxRIGHT | wxTOP | wxBOTTOM, 6); GetSizer()->Add(nextButton, 0, wxEXPAND | wxRIGHT | wxTOP | wxBOTTOM, 6); @@ -269,6 +273,11 @@ TreeView::Search::Search(TreeView& treeView) : TreeView::Search::~Search() { + _closeTimer.Stop(); + + // Always hide popup windows before destroying them, otherwise the + // wx-internal wxCurrentPopupWindow pointer doesn't get cleared (in MSW at least) + _popup->Hide(); _popup->Destroy(); _popup = nullptr; _curSearchMatch = wxDataViewItem();