I have noticed a tool can persist in the tooltip tools array when it should be removed. In particular, I have found that when scrolling a tree control this can occur. Later, when the timer goes off, the tip code can find the wrong tool as it finds the tool that was previously under the mouse before it was scrolled away. Essentially the array contains two tools with the same rect and the search is top down using the point in rectangle paradigm to find the tool. The second item is placed at the end of the array and it is the item currently under the mouse and the item for which the tip should be displayed. Instead, the tip for the item that was under the mouse before the scroll occurred is displayed.
In CXTPToolTipContext::FilterToolTipMessageHelper I have added WM_MOUSEWHEEL at the bottom of the routine so that CancelTooltips is called on that event too when that event or the other events in the test for calling CancelTooltips is made.
This issue can be quite hard to duplicate and I knew it was related to mouse scrolling on a tree control. Without this change, when a tip appears for a tree item and I scroll, the tip remains on screen until it times out. We have a lengthy timeout as we have html tooltips that contain extensive information and even some that have short videos.
Now with this change, as soon as I scroll the tip is cancelled. So far in testing, the issue where the tool remains in the array of tools even though the item was scrolled has not occurred.
It appears "random" when this issue shows up due to timing (cpu load) and the timer involved.
I think this change should be added to the current CJ code.
BOOL bKeys = (message >= WM_KEYFIRST && message <= WM_KEYLAST) || (message >= WM_SYSKEYFIRST && message <= WM_SYSKEYLAST); if ((bKeys || (message == WM_LBUTTONDOWN || message == WM_LBUTTONDBLCLK) || message == WM_MOUSEWHEEL || || (message == WM_RBUTTONDOWN || message == WM_RBUTTONDBLCLK) || (message == WM_MBUTTONDOWN || message == WM_MBUTTONDBLCLK) || (message == WM_NCLBUTTONDOWN || message == WM_NCLBUTTONDBLCLK) || (message == WM_NCRBUTTONDOWN || message == WM_NCRBUTTONDBLCLK) || (message == WM_NCMBUTTONDOWN || message == WM_NCMBUTTONDBLCLK))) { CancelToolTips(); }
|