From 4db8638f7e291280a843ebf69a7ceb7120a8b60a Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 13 Sep 2019 09:20:31 +0200 Subject: [PATCH] PANEL_SETUP_NETCLASSES: fix not working (immediately closed) wxChoice widgets to select a filter This happens with wxWidgets 3.0.4 on Windows and is a side effect of a call to Layout(). The fix just calls Layout() only when needed. Fixes: lp:1843594 https://bugs.launchpad.net/kicad/+bug/1843594 --- pcbnew/dialogs/panel_setup_netclasses.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pcbnew/dialogs/panel_setup_netclasses.cpp b/pcbnew/dialogs/panel_setup_netclasses.cpp index bfc0380b68..ecb8a55f7d 100644 --- a/pcbnew/dialogs/panel_setup_netclasses.cpp +++ b/pcbnew/dialogs/panel_setup_netclasses.cpp @@ -488,9 +488,16 @@ void PANEL_SETUP_NETCLASSES::OnUpdateUI( wxUpdateUIEvent& event ) wxSize netclassSize = GetClientSize(); netclassSize.y -= m_membershipSize.y; - m_netclassesPane->SetMinSize( netclassSize ); - m_netclassesPane->SetMaxSize( netclassSize ); - Layout(); + // Modify m_netclassesPane size only if needed, because calling Layout() + // has a annoying effect if a wxChoice is open, it is closed by this call. + // So it cannot blindly called inside each wxUpdateUIEvent event, + // at least on Windows + wxWidgets 3.0 (do not happens with 3.1.1). + if( netclassSize.y != m_netclassesPane->GetSize().y ) + { + m_netclassesPane->SetMinSize( netclassSize ); + m_netclassesPane->SetMaxSize( netclassSize ); + Layout(); + } }