From 63b53c3968ae2ab9fa94b4d172909e5d053563bf Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Wed, 12 Aug 2020 00:09:08 +0100 Subject: [PATCH] Force regeneration of the lib tree on first load Just setting the text field is not guaranteed to fire a text event, so we must forcefully call the regenerate function to ensure the preselect is handled. Fixes https://gitlab.com/kicad/code/kicad/issues/4105 --- common/widgets/lib_tree.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/widgets/lib_tree.cpp b/common/widgets/lib_tree.cpp index b3fc9636b2..3281873bda 100644 --- a/common/widgets/lib_tree.cpp +++ b/common/widgets/lib_tree.cpp @@ -117,8 +117,10 @@ LIB_TREE::LIB_TREE( wxWindow* aParent, LIB_TABLE* aLibTable, LIB_TREE_MODEL_ADAP { m_query_ctrl->SetHint( _( "Filter" ) ); m_query_ctrl->SetFocus(); - m_query_ctrl->SetValue( wxEmptyString ); // SetValue() is required here to kick off - // initial sorting and pre-selection. + m_query_ctrl->SetValue( wxEmptyString ); + + // Force an update of the adapter with the empty text to ensure preselect is done + Regenerate( false ); } // There may be a part preselected in the model. Make sure it is displayed.