Hi,
I'm using Balloon Tooltips in a program. How can I force it to write multiple lines, rather than one long line?
Thanks,
Brian
does \n create a new line?
LarryMc
QuoteTo force the ToolTip control to use multiple lines, send a TTM_SETMAXTIPWIDTH message, specifying the width of the display rectangle. Text that exceeds this width will wrap to the next line rather than widening the display region. The rectangle height will be increased as needed to accommodate the additional lines. The ToolTip control will wrap the lines automatically, or you can use a carriage return/line feed combination, \r\n, to force line breaks at particular locations.
LarryMc
Larry,
Didn't see that one, after my searching, and \n doesn't work, either
I'll have a look at that message, thanks
Brian
Hi Brian,
Larry was on the right lines, this is how you do multiple lines:
CONTROLCMD w1,98,@TBSETTIP,9,"Opens the help file" + "\n" + "2nd line" + "\n" + "3rd line of text"
I amended the 'Loadtoolbar' example program.
So just use "\n" between each line.
Andy.
Hi,
Larry and Andy set me on the right path, and after many re-compiles, I finally got it!
CONST TTM_SETMAXTIPWIDTH=(0x400+24)
UINT hTooltip=TOOLTIPCONTROL(win,@TTS_ALWAYSTIP|@TTS_NOANIMATE|@TTS_NOFADE|@TTS_BALLOON,0)
TTADDTOOL hTooltip,@TTF_SUBCLASS|@TTF_IDISHWND|@TTF_CENTERTIP,GETCONTROLHANDLE(win,1),win.hWnd,"If you test this, the line will wrap at the nearest space to 150 pixels"
SENDMESSAGE hTooltip,TTM_SETMAXTIPWIDTH,0,150
The above code assumes the main window is called win, and you have a button with an ID of 1
Hope this helps someone,
Brian
What Andy and I were telling you (use \n ) was correct for toolbars and apparently is the window standard because of the qoute from the SDK.
You are using the standalone ToolTip control from the ControlPak.
Evidently there is an internal difference in the Pak's version.
Either way, glad you got it working.
LarryMc
Larry,
I should have probably said I was using the Control Pak to create the tooltips
Anyways, been messing a bit with them, and rather like this idea. Runs without
a manifest file, but the button and info icon displays a lot cleaner with the manifest
Code and manifest supplied...
Uh oh, you will have to rename "Tooltips Code.exe.txt" to "Tooltips Code.exe.manifest"
Brian
Update: Added some colour to the tooltip background