5

I found out that sometimes, the text on my tooltip is not fully displayed. Here's an example for such text:

WWWWW WWWW, WW WWWWWWWW

WWWWWWWWWW WWWWWWWWWWWWW WWWWWWWWW

Screenshot:

screenshot

My tooltip creation code (WTL):

CToolTipCtrl tooltip;
TOOLINFO toolInfo;

tooltip.Create(window, NULL, NULL, TTS_NOFADE);

toolInfo = CToolInfo(TTF_IDISHWND | TTF_TRACK | TTF_ABSOLUTE, 
    tooltip, 0, NULL, L"WWW...");

tooltip.AddTool(&toolInfo);

tooltip.SendMessage(TTM_SETTITLE, (WPARAM)hIcon, (LPARAM)L"Title");

Is it a known issue? Any help is appreciated. Thanks!

Paul
  • 6,061
  • 6
  • 39
  • 70
  • 1
    what mean `sometimes` ? the *same* text (length) can be sometime fully displayed and sometime not ? or begin from some concrete length it begin truncated ? – RbMm Aug 20 '17 at 10:28
  • @RbMm By sometimes I mean - with some texts. The behavior is consistent, i.e. the same text is either truncated or not. – Paul Aug 20 '17 at 10:29
  • passing `tooltip` into ctor of `CToolInfo` seems to be a typo - a real control's HWND should passed instead – AntonK Apr 23 '23 at 20:03

1 Answers1

5

Looks like calling tooltip.SetMaxTipWidth(MAXINT); fixes it.

Non-WTL version: SendMessage(..., TTM_SETMAXTIPWIDTH, 0, MAXINT);

Paul
  • 6,061
  • 6
  • 39
  • 70