We like to show a tooltip depends on key state.
Sample use case: Tooltip over a link (like in an internet browser). Mouse over a link shows "follow link" STRG+Mouse over a link shows "follow link a new tab"
But we have serveral problems:
a) if mouse is over a link and you press STRG after, the tooltip is to be destroyed!? This happends because you scan for key strokes!? (system tooltip don't hide if pressing a key)
BOOL bKeys = (message >= WM_KEYFIRST && message <= WM_KEYLAST) || (message >= WM_SYSKEYFIRST && message <= WM_SYSKEYLAST); if ((bKeys || (message == WM_LBUTTONDOWN || message == WM_LBUTTONDBLCLK) || (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(); }
|
b) if the new text was calculated in OnToolHitTest(CPoint point, TOOLINFO* pTI) and written to pTI->lpszText, the base class doesn't modify the tooltip! If I manually call TTM_UPDATETIPTEXT, I saw that the string was internally updated in array m_arrTools but no recalculation and redraw action follows (like system tooltip)!!!!!!! A manually redaw don't neither work, because the OnPaint() method reads the old string from m_toolVisible.
Please support changes of tooltip text while it is displayed! Thanks
|