79173989

Date: 2024-11-10 01:34:08
Score: 1
Natty:
Report link

The Windows documentation suggests that LVN_GETINFOTIP is not sent by report view listview controls. In practice I found this to be the case (2024).

So in these circumstances how to display the tooltip?

I can see why it's necessary to find some alternative to an ordinary tooltip window when using a listview control. The problem with a large control like a listview is that although a TTN_NEEDTEXT notification message (asking for the display text to be specified) will be sent when the cursor first enters the control, a second TTN_NEEDTEXT will not be sent if the cursor then moves within the control onto a different item. This is because the cursor is still in the same control.

One workaround for this is to set the listview style to LVS_EX_TRACKSELECT and then monitor the LVN_HOTTRACK messages sent to the listview's parent. When monitoring this message, if iItem in NMLISTVIEW is -1 then the cursor is in the listview but is not over an item so no action should be taken. But otherwise you can send TTM_POPUP to the tooltip window.

This causes the tooltip to appear at the cursor and before doing so it will send TTN_NEEDTEXT to the window which was specified when the tooltip was associated with the listview using TTM_ADDTOOL.

To avoid sending TTM_POPUP each time the cursor moves in the listview control, only send it if hItem (and iSubItem if required to be tested) is different from the last time LVN_HOTTRACK was received.

Reasons:
  • Long answer (-1):
  • No code block (0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: jorgon