This removes the arbitrariness of using the first child which didn't make any
sense when the popup had several controls inside it, e.g. in wxRichToolTip
case this resulted in the mouse capture being given to wxStaticBitmap showing
the tooltip icon even though it didn't need it at all.
This probably doesn't really change the observable behaviour but seems more
logical.
See #15288.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74680
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
void wxPopupTransientWindow::Popup(wxWindow *winFocus)
{
+ // If we have a single child, we suppose that it must cover the entire
+ // popup window and hence we give the mouse capture to it instead of
+ // keeping it for ourselves.
+ //
+ // Notice that this works best for combobox-like popups which have a single
+ // control inside them and not so well for popups containing a single
+ // wxPanel with multiple children inside it but OTOH it does no harm in
+ // this case neither and we can't reliably distinguish between them.
const wxWindowList& children = GetChildren();
- if ( children.GetCount() )
+ if ( children.GetCount() == 1 )
{
m_child = children.GetFirst()->GetData();
}