I am testing if it is possible to have a tool tip show up on top of a ListView Group Header
. The following code works, which is in the subclass procedure for the ListView
. The main issue I'm asking about is when I move away from the group header, ie to a list item, the tool tip goes away then comes back until it times out normally.
I also found if I come in right from the start (not on a group header), it pops up again on the call:
SendMessage(info->hToolTip, TTM_TRACKACTIVATE, FALSE, (LPARAM)&info->ToolInfo);
Is there a way to prevent the tool tip from showing up again?
case WM_MOUSEMOVE: { auto info = reinterpret_cast<SubclassInfo*>(dwRefData); if (info) { // get mouse position POINT pt = { LOWORD(lParam), HIWORD(lParam) }; // total groups int groupCount = SendMessage(hWnd, LVM_GETGROUPCOUNT, 0, 0); for (int groupId = 1; groupId <= groupCount; ++groupId) { // group header rectangle only RECT grpRect; if (ListView_GetGroupRect(hWnd, groupId, LVGGR_HEADER, &grpRect)) { if (PtInRect(&grpRect, pt)) { // Mouse is over this group's header currentGroupId = groupId; SendMessage(info->hToolTip, TTM_TRACKPOSITION, 0, MAKELPARAM(pt.x, pt.y)); SendMessage(info->hToolTip, TTM_TRACKACTIVATE, TRUE, (LPARAM)&info->ToolInfo); return DefSubclassProc(hWnd, uMsg, wParam, lParam); } } } // Deactivate tooltip if not over any header SendMessage(info->hToolTip, TTM_TRACKACTIVATE, FALSE, (LPARAM)&info->ToolInfo); } break; }