Page 2 of 2

Posted: Fri Oct 20, 2006 6:59 am
by huge
Hi,
To awaken an old thread...
I have found the solution for this problem : TTM_SETMAXTIPWIDTH must be supplied at least once for the "\r\n" combo to work.

ie, replace the code inside #ifdef TTM_SETMAXTIPWIDTH with something like: SendMessage((HWND)GetToolTipCtrl(), TTM_SETMAXTIPWIDTH, 0, 300);

That is it. This fixes it for subsequent "SetToolTip()" calls.

You should also decide how to handle "\n" in a consistent way. ie.
1. specify "\n" and replace it with "\r\n" or space depending of comctrl version.
2. specify "\r\n" and strip them depending.
3. Have "IsMultiLineSupported" and let the user decide (in combination with 1 or 2 ?).

Currently I am using option 4. : specify "\r\n" and ignore other probelms.

Posted: Tue Nov 07, 2006 2:59 pm
by Paulsen
huge wrote: replace the code inside #ifdef TTM_SETMAXTIPWIDTH with something like: SendMessage((HWND)GetToolTipCtrl(), TTM_SETMAXTIPWIDTH, 0, 300);
I second that. Any sensible value between about 300-450 will work nicely. The code as it stands now is simply an elaborately done, over-engineered bug.

Set the tool tip size to the width of the first line, why come up with something like this? If you happen to pick the wrong font to calculate the size (which seems to happen most of the time), not even the first line will display correctly.

I will open a bug report on the source forge tracker, if no one else has done this already.