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
This commit is contained in:
Ian McInerney 2020-08-12 00:09:08 +01:00
parent 433616cbf0
commit 63b53c3968
1 changed files with 4 additions and 2 deletions

View File

@ -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->SetHint( _( "Filter" ) );
m_query_ctrl->SetFocus(); m_query_ctrl->SetFocus();
m_query_ctrl->SetValue( wxEmptyString ); // SetValue() is required here to kick off m_query_ctrl->SetValue( wxEmptyString );
// initial sorting and pre-selection.
// 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. // There may be a part preselected in the model. Make sure it is displayed.