Opened 9 years ago

Last modified 9 years ago

#10492 confirmed defect

wxListCtrl can show two tool tips if you use SetToolTip

Reported by: lesnewell Owned by:
Priority: low Milestone:
Component: wxMSW Version: stable-latest
Keywords: wxListCtrl wxToolTip simple Cc:
Blocked By: Blocking:
Patch: no

Description

If you use a wxListCtrl in report view and size the control so that the column text does not fit in the available space it will show a tool tip when you hover the mouse over it. This tip shows the full text. However if you now use SetToolTip to create a tool tip, that tip shows as well so you end up with two tips showing at the same time.

Looking through msw/listctrl.cpp, it appears that the problem is here:
void wxListCtrl::MSWSetExListStyles()
{

for comctl32.dll v 4.70+ we want to have some non default extended
styles because it's prettier (and also because wxGTK does it like this)
if ( wxApp::GetComCtl32Version() >= 470 )
{

::SendMessage(GetHwnd(), LVM_SETEXTENDEDLISTVIEWSTYLE,

0, LVS_EX_LABELTIP | LVS_EX_FULLROWSELECT | LVS_EX_SUBITEMIMAGES);

}

}

The style LVS_EX_LABELTIP causes Windows to automatically show a tip. wx does not know about this tip so it shows it's own as well. Another side effect of this style is that wxToolTip::Enable will not work for wxListCtrls (see Ticket #10072). Unfortunately simply removing this style could break existing programs.

Attached is a patch to svn-trunk cube demo that demonstrates the fault.

Attachments (1)

cube.patch download (1.9 KB) - added by lesnewell 9 years ago.

Download all attachments as: .zip

Change History (3)

Changed 9 years ago by lesnewell

comment:1 Changed 9 years ago by vadz

  • Keywords simple added
  • Priority changed from normal to low
  • Status changed from new to confirmed

I don't understand why is it a problem to be honest. The tooltip showing the full text of an item is very useful and IMO should be shown independently of the other tooltips.

But well, I guess we could reset LVS_EX_LABELTIP in wxListCtrl::SetToolTip().

P.S. Trac has some trouble displaying the attached patch, it only shows the first change in it but not the subsequent ones, no idea why.

comment:2 Changed 9 years ago by lesnewell

Thanks. That sounds like a good solution though it still leaves wxToolTip::Enable broken if you don't use wxListCtrl::SetToolTip(). It doesn't look like many people use wxToolTip::Enable as it has been broken for a long time.

Note: See TracTickets for help on using tickets.