Avoid showing 2 tooltips simultaneously in wxMSW wxListCtrl

Only show the built-in control tooltips if we're not showing any custom
ones.

Closes https://github.com/wxWidgets/wxWidgets/pull/1500

Closes #10492.
This commit is contained in:
oneeyeman1
2019-08-23 21:34:30 -05:00
committed by Vadim Zeitlin
parent 0b7a7141e3
commit 5e7b515349
2 changed files with 22 additions and 1 deletions

View File

@@ -390,6 +390,9 @@ protected:
{ return MSWGetBestViewRect(width, -1).y; }
virtual int DoGetBestClientWidth(int height) const wxOVERRIDE
{ return MSWGetBestViewRect(-1, height).x; }
#if wxUSE_TOOLTIPS
virtual void DoSetToolTip(wxToolTip *tip) wxOVERRIDE;
#endif // wxUSE_TOOLTIPS
wxSize MSWGetBestViewRect(int x, int y) const;

View File

@@ -327,7 +327,6 @@ void wxListCtrl::MSWSetExListStyles()
// we want to have some non default extended
// styles because it's prettier (and also because wxGTK does it like this)
int exStyle =
LVS_EX_LABELTIP |
LVS_EX_FULLROWSELECT |
LVS_EX_SUBITEMIMAGES |
// normally this should be governed by a style as it's probably not
@@ -335,6 +334,13 @@ void wxListCtrl::MSWSetExListStyles()
// it seems better to enable it by default than disable
LVS_EX_HEADERDRAGDROP;
// Showing the tooltip items not fitting into the control is nice, but not
// really compatible with having custom tooltips, as this could result in
// showing 2 tooltips simultaneously, which would be confusing. So only
// enable this style if there is no risk of this happening.
if ( !GetToolTip() )
exStyle |= LVS_EX_LABELTIP;
if ( wxApp::GetComCtl32Version() >= 600 )
{
// We must enable double buffering when using the system theme to avoid
@@ -3605,4 +3611,16 @@ static void wxConvertToMSWListCol(HWND hwndList,
}
}
#if wxUSE_TOOLTIPS
void wxListCtrl::DoSetToolTip(wxToolTip *tip)
{
wxWindow::DoSetToolTip(tip);
// Add or remove LVS_EX_LABELTIP style as necessary.
MSWSetExListStyles();
}
#endif // wxUSE_TOOLTIPS
#endif // wxUSE_LISTCTRL