8

I'm creating a ToolTip window and adding tools to it using the flags TTF_IDISHWND | TTF_SUBCLASS. (c++, win32)

I have a manifest file such that my program uses the new WindowsXP themes (comctrl32 version 6).

When I hover over a registered tool, the tip appears.
Good.
When I click the mouse, the tip disappears.
Ok.
However, moving away from the tool and back again does not make the tip re-appear. I need to hover over a different tool and then come back to my tool to get the tip to come back.

When I remove my manifest file (to use the older non-XP comctrl32), the problem goes away.

After doing some experimentation, I discovered the following differences between ToolTips in Comctl32 version 5 (old) and Comctl32 version 6 (new):

  • New TTF_TRANSPARENT ToolTips (when used In-Place) actually return HTCLIENT from WM_NCITTEST if a mouse button is down, thus getting WM_LBUTTONDOWN and stealing focus for a moment before vanishing. This causes the application's border to flash.

  • Old TTF_TRANSPARENT ToolTips always return HTTRANSPARENT from WM_NCHITTEST, and thus never get WM_LBUTTONDOWN themselves and never steal focus. (This seems to be just aesthetic, but may impact the next point...)

  • New ToolTips seem not to get WM_TIMER events after a mouse-click, and only resume getting (a bunch of) timer events after being de-activated and re-activated. Thus, they do not re-display their tip window after a mouse click and release.

  • Old ToolTips get a WM_TIMER message as soon as the mouse is moved again after click/release, so they are ready to re-display their tip.

Thus, as a comctl32 workaround, I had to:

  • subclass the TOOLTIPS_CLASS window and always return HTTRANSPARENT from WM_NCHITTEST if the tool asked for transparency.

  • avoid using TTF_SUBCLASS and rather process the mouse messages myself so I could de-activate/re-activate upon receiving WM_xBUTTONUP.

I assume that the change in internal behavior was to accommodate the new "clickable" features in ToolTips like hyperlinks, but the hover behavior appears to be thus broken.

Does anyone know of a better solution than my subclass workaround? Am I missing some other point?

4

2 回答 2

1

您不是唯一一个遇到这些 DLLS 之间的工具提示兼容性问题的人。

也对主题通用控件中的新工具提示感到困惑。在添加清单和主题化我们的应用程序之前,我们已经在使用鼠标消息和激活/停用提示 - 所以听起来你所做的并不太疯狂。

我们仍然面临着随着鼠标移动(不仅仅是在悬停时)不断发送 TTN_NEEDTEXT 消息、大提示定位问题(可能不是新事物)以及发送奇怪的 unicode 消息而不是 ANSI 版本(我计划在某个时候作为问题发布)。

于 2008-09-09T13:21:41.823 回答
0

我不知道,但这听起来像是一个非常“难”的问题(从某种意义上说,所有现实世界的问题都非常难)。我敢打赌,根本问题与焦点的设置有关。手动执行此操作的 Windows 是邪恶的,并且通常会遇到各种错误。

于 2008-09-09T07:23:15.677 回答